bla*_*iet 32 .net c# visual-studio-2008
我正在尝试组织我的工作区,并希望将我的中间对象放在与..\build\obj.csproj文件相关的文件夹中.所以我说:
<IntermediateOutputPath>..\build\obj\Debug</IntermediateOutputPath>
在.csproj文件中.现在,在构建解决方案时,中间对象被放置在该位置,但问题是在打开解决方案时,仍然会在.csproj文件所在的目录中创建一个obj目录(产生效果obj).这个目录是什么,以及如何重新定位它?
Dar*_*rov 29
您可以尝试执行此操作(不要忘记将根据您要定位的构建类型使用调试和发布部分):
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
...
<BaseIntermediateOutputPath>..\build\obj</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
...
<BaseIntermediateOutputPath>..\build\obj</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
像微软这样做:
<PropertyGroup>
<IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU' ">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
<IntermediateOutputPath Condition=" '$(PlatformName)' != 'AnyCPU' ">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
小智 5
根据这篇文章Directory.Build.props,可以在包含项目文件的文件夹中创建一个名为 的文件.csproj。为了重新定位obj文件夹,我们可以添加
<BaseOutputPath>..\Build</BaseOutputPath>
Run Code Online (Sandbox Code Playgroud)
到项目文件PropertyGroup中的部分.csproj,并写入
<?xml version="1.0"?>
<Project>
<PropertyGroup>
<BaseIntermediateOutputPath>..\Intermediate\obj</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)</IntermediateOutputPath>
<!--The following is the default configuration for "MSBuildProjectExtensionsPath"-->
<!--<MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)</MSBuildProjectExtensionsPath>-->
</PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
到Directory.Build.props文件。
| 归档时间: |
|
| 查看次数: |
26072 次 |
| 最近记录: |