C#项目附加输出路径

时间:2011-08-02 01:10:29

标签: c# msbuild build project-management

在项目文件中,通常我们可以看到以下内容来设置项目输出路径。现在我想知道是否有办法设置额外的输出路径。即,构建的二进制文件也将被复制到附加路径。

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  <DebugSymbols>true</DebugSymbols>
  <DebugType>full</DebugType>
  <Optimize>false</Optimize>
  <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
  <DefineConstants>TRACE</DefineConstants>
  <ErrorReport>prompt</ErrorReport>
  <WarningLevel>4</WarningLevel>
</PropertyGroup>

1 个答案:

答案 0 :(得分:2)

将post-build事件添加到项目/解决方案配置中会很简单,该配置将文件从原始构建位置复制到指定的新位置。转到项目属性,在“构建事件”下,将以下内容添加到构建后事件命令行:

xcopy /E $(ProjectDir)bin\Release\ [pathToMyDestination]

顺便说一下,我猜你想把你的发布版本发布给主机。在这种情况下,值得研究持续集成软件,它为您提供强大的功能。我们已经使用了几个,目前正在使用Team City(免费)。

相关问题