vs中怎么设置统一的output路径
背景:
1、一个sln下有多个csproj项目,让所有csproj生成的dll路径在sln根目录下的ouput文件夹
解决办法:
1、在sln目录下新建Directory.Build.props文件,文件内容如下:
 <Project>
    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
        <CustomOutputPath>$(SolutionDir)output\Debug\</CustomOutputPath>
    </PropertyGroup>
    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
        <CustomOutputPath>$(SolutionDir)output\Release</CustomOutputPath>
    </PropertyGroup>
</Project>
2、编辑csproj文件,使 
示例如下
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>$(CustomOutputPath)</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>$(CustomOutputPath)</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
3、重新加载csproj项目,或者重新打开VS,重新生成即可。
| 作者:Bonker 出处:http://www.cnblogs.com/Bonker WeiXin:iBonker | 
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号