如何在C#中配置中间输出目录?

时间:2010-07-22 16:43:18

标签: c# .net visual-studio-2008

3 个答案:

答案 0 :(得分: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>

答案 1 :(得分:8)

像Microsoft一样:

  <PropertyGroup>
    <IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU' ">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
    <IntermediateOutputPath Condition=" '$(PlatformName)' != 'AnyCPU' ">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
  </PropertyGroup>

答案 2 :(得分:1)

我用过:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>$(OBJDIR)\$(SolutionName)\bin\$(Configuration)\</OutputPath>
<BaseIntermediateOutputPath>$(OBJDIR)\$(SolutionName)\obj\$(Configuration)\</BaseIntermediateOutputPath> 
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\</IntermediateOutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

(在VS11 Beta,FWIW中),它运行正常。

我机器上的OBJDIR指向e:\ BuildOutput