How to configure the intermediate output directory in C#

后端 未结 3 614
鱼传尺愫
鱼传尺愫 2021-01-31 09:07

I\'m trying to organize my workspace and want my intermediate objects to be put in the ..\\build\\obj folder in relation to my .csproj file. So I put:

相关标签:
3条回答
  • 2021-01-31 09:10

    Do this like Microsoft:

      <PropertyGroup>
        <IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU' ">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
        <IntermediateOutputPath Condition=" '$(PlatformName)' != 'AnyCPU' ">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
      </PropertyGroup>
    
    0 讨论(0)
  • 2021-01-31 09:11

    You could try to do this (don't forget that there are Debug and Release sections which will be used depending on what type of build you are targeting):

    <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>
    
    0 讨论(0)
  • 2021-01-31 09:18

    I've used:

    <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>
    </PropertyGroup>
    

    (In Visual Studio 2012 Beta, FWIW), and it works fine.

    The OBJDIR on my machine points to E:\BuildOutput.

    0 讨论(0)
提交回复
热议问题