2024年1月7日发(作者:)

无法读取项目文件 .csproj,请确认 声明中的路径正确,且磁盘上存在该文件。

找了相关的错误,找不到原因,其他的项目文件都加载进去,但不知为什么这个加载不进去。我就查看了一下其他项目的.csproj的文件,与发生错误的.csproj文件核对下,

把其中

Project="$(MSBuildExtensionsPath)s" />

改为:

Project="$(MSBuildExtensionsPath)s" Condition="'$(ion)' ==

'8.0'" />

Project="$(MSBuildExtensionsPath)s" Condition="'$(ion)' ==

'9.0'" />

都可以加载进去项目文件了!这个一般在网上下载的项目,或者朋友给的项目总出这样问题,开始一直都没解决,今天不知道怎么来灵感了。去对照了一下各自

的.csproj文件中的节点的配置!结果还真给解决了问题,不错。呵呵高兴!

以下方法是我在网上搜的,我用的是vs2008版本!估计是他是用的vs2005版本的。

大家经常会非常辛苦的在网上找到自己想要的源程序,在我们欣喜若狂打开的时候,却提示“未找到导入的项目“$:s”。请确认 声明中的路径正确,且磁盘上存在该文件。

解决办法:将项目文件(.csproj)用记事本打开,然后找到节点,作如下操作:

替换为:

这个才是最终的解决方案!!!

或者直接将下述文本复制到记事本,另存为“s”,放到项目所在盘符的根目录下,一键OK.

复制内容如下:

AssemblyName=",

PublicKeyToken=b03f5f7f11d50a3a"/>

TaskName="CreateCSharpManifestResourceName"

Version=2.0.0.0, Culture=neutral,

$(MSBuildAllProjects);$(MSBuildBinPath)s

.cs

C#

Name="CreateManifestResourceNames"

Condition="'@(ResxWithNoCulture)@(ResxWithCulture)@(NonResxWithNoCulture)@(NonResxWithCulture)'!=''"

DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"

>

ResourceFiles="@(ResxWithNoCulture)"

RootNamespace="$(RootNamespace)">

ItemName="ManifestResourceWithNoCultureName"/>

ResourceFiles="@(ResxWithCulture)"

RootNamespace="$(RootNamespace)">

ItemName="ManifestResourceWithCultureName"/>

ResourceFiles="@(NonResxWithNoCulture)"

RootNamespace="$(RootNamespace)">

ItemName="ManifestNonResxWithNoCulture"/>

ResourceFiles="@(NonResxWithCulture)"

RootNamespace="$(RootNamespace)">

ItemName="ManifestNonResxWithCulture"/>

TaskParameter="ManifestResourceNames"

TaskParameter="ManifestResourceNames"

false

<_DisabledWarnings>$(NoWarn)

''">true

('$(TargetFrameworkVersion)' != 'v1.1')">

Condition=" '$(UseHostCompilerIfAvailable)' ==

!= 'v1.0') and

!= <_DisabledWarnings Condition="'$(_DisabledWarnings)'

''">$(_DisabledWarnings);

<_DisabledWarnings>$(_DisabledWarnings)1701;1702

Condition="'$(DocumentationFile)'!=''"/>

_ComputeNonExistentFileProperty

Name="CoreCompile"

Inputs="$(MSBuildAllProjects);

@(Compile);

@(ManifestResourceWithNoCulture);

Include="$(DocumentationFile)"

$(ApplicationIcon);

$(AssemblyOriginatorKeyFile);

@(ManifestNonResxWithNoCultureOnDisk);

@(ReferencePath);

@(CompiledLicenseFile);

@(EmbeddedDocumentation);

@(CustomAdditionalCompileInputs)"

Outputs="@(DocFileItem);

@(IntermediateAssembly);

$(NonExistentFile);

@(CustomAdditionalCompileOutputs)"

DependsOnTargets="$(CoreCompileDependsOn)"

>

AdditionalLibPaths="$(AdditionalLibPaths)"

AddModules="@(AddModules)"

AllowUnsafeBlocks="$(AllowUnsafeBlocks)"

BaseAddress="$(BaseAddress)"

CheckForOverflowUnderflow="$(CheckForOverflowUnderflow)"

CodePage="$(CodePage)"

DebugType="$(DebugType)"

DefineConstants="$(DefineConstants)"

DelaySign="$(DelaySign)"

DisabledWarnings="$(_DisabledWarnings)"

DocumentationFile="@(DocFileItem)"

EmitDebugInformation="$(DebugSymbols)"

ErrorReport="$(ErrorReport)"

FileAlignment="$(FileAlignment)"

GenerateFullPaths="$(GenerateFullPaths)"

KeyContainer="$(KeyContainerName)"

KeyFile="$(KeyOriginatorFile)"

LangVersion="$(LangVersion)"

MainEntryPoint="$(StartupObject)"

ModuleAssemblyName="$(ModuleAssemblyName)"

NoConfig="true"

NoLogo="$(NoLogo)"

NoStandardLib="$(NoStdLib)"

Optimize="$(Optimize)"

OutputAssembly="@(IntermediateAssembly)"

PdbFile="$(PdbFile)"

Platform="$(PlatformTarget)"

References="@(ReferencePath)"

Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile)"

ResponseFiles="$(CompilerResponseFile)"

Sources="@(Compile)"

TargetType="$(OutputType)"

ToolPath="$(CscToolPath)"

TreatWarningsAsErrors="$(TreatWarningsAsErrors)"

UseHostCompilerIfAvailable="$(UseHostCompilerIfAvailable)"

Utf8Output="$(Utf8Output)"

WarningLevel="$(WarningLevel)"

WarningsAsErrors="$(WarningsAsErrors)"

WarningsNotAsErrors="$(WarningsNotAsErrors)"

Win32Icon="$(ApplicationIcon)"

Win32Resource="$(Win32Resource)"

/>