1

我正在尝试自己生成一个 csproj 文件。当我用这个生成的 csproj 打开我的项目时,结构看起来相当不错,但是当我构建项目时,项目中的每个 .cs 文件都会出现以下错误

无法打开源文件 'wrongpath/MySource.cs' ('系统找不到指定的文件。') (CS1504)

我想知道这条错误的路径从何而来?在我的csproj中,路径是正确的,这里不一样...

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
    <ProjectGuid>{724F3A09-AACF-487E-BF67-193E2E4E5D9C}</ProjectGuid>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <OutputType>Exe</OutputType>
    <RootNamespace>MyProject.csproj</RootNamespace>
    <AssemblyName>MyProject.csproj</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <SignAssembly>False</SignAssembly>
    <DelaySign>False</DelaySign>


    <BaseIntermediateOutputPath>Path\to\the\project\target\net\obj\</BaseIntermediateOutputPath>
    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
    <NoStdLib>False</NoStdLib>
    <WarningLevel>4</WarningLevel>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <TargetFrameworkProfile />
    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <RegisterForComInterop>False</RegisterForComInterop>
    <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
    <BaseAddress>4194304</BaseAddress>
    <FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug'">
    <OutputPath>Path\to\the\project\target\net\Debug\</OutputPath>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>Full</DebugType>
    <Optimize>False</Optimize>
    <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <IntermediateOutputPath>Path\to\the\project\target\net\Debug</IntermediateOutputPath>
    <StartAction>Project</StartAction>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <OutputPath>Path\to\the\project\target\net\Release\</OutputPath>
    <DebugSymbols>False</DebugSymbols>
    <DebugType>None</DebugType>
    <Optimize>True</Optimize>
    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
    <DefineConstants>TRACE</DefineConstants>
    </PropertyGroup>
<ItemGroup>
    <Reference Include="ICSharpCode.SharpZipLib.dll">
        <HintPath>Path\to\the\project/../../ikvm-7.2.4630.6-eh/bin/ICSharpCode.SharpZipLib.dll</HintPath>
    </Reference>
    [... other references written the same way]

    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="NUnit.Framework" />
</ItemGroup>
<ItemGroup>
    <Folder Include="Path\to\the\project\src\test\net\MyProject\builders" />
    <Folder Include="Path\to\the\project\src\test\net\MyProject\service" />
    <Folder Include="Path\to\the\project\src\test\net\MyProject" />
    <Folder Include="Path\to\the\project\src\test\net\resources" />
    <Folder Include="Path\to\the\project\src\test\net" />
    <Folder Include="Path\to\the\project\src\test\resources\examples\requests" />
    <Folder Include="Path\to\the\project\src\test\resources\examples\responses" />
    <Folder Include="Path\to\the\project\src\test\resources\examples" />
    <Folder Include="Path\to\the\project\src\test\resources\P12\acc" />
    <Folder Include="Path\to\the\project\src\test\resources\P12\int" />
    <Folder Include="Path\to\the\project\src\test\resources\P12" />
    <Folder Include="Path\to\the\project\src\test\resources" />
</ItemGroup>
<ItemGroup>
    <None Include="src/test/net/resources/MyProject.test.session.properties" />
    <None Include="src/test/resources/MyProject.properties" />
    [...other properties files added the same way]

</ItemGroup>
<ItemGroup>
    <Compile Include="src/test/net/MyProject/AbstractTestClass.cs" />
    <Compile Include="src/test/net/MyProject/builders/FirstTest.cs" />
    <Compile Include="src/test/net/MyProject/builders/SecondTest.cs" />
    <Compile Include="src/test/net/MyProject/builders/ThirdTest.cs" />
    [...other .cs files added the same way]
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />

编辑:我正在使用 SharpDevelop

4

0 回答 0