MSBuild OutputPath属性和绝对路径

Fre*_*Vig 8 msbuild

我正在尝试将OutputPath值设置为绝对路径:

<OutputPath>c:\Projects\xxx\Deployment</OutputPath>
Run Code Online (Sandbox Code Playgroud)

但我得到这个错误:

Error   17  The expression "[System.IO.Path]::GetFullPath(D:\Projects\xxx\trunk\xxx.Web.Deployment\c:\Projects\xxx\Deployment\)" cannot be evaluated. The given path's format is not supported.     1   1   xxx.Web.Deployment
Run Code Online (Sandbox Code Playgroud)

有没有办法使用OutputPath属性的绝对路径?我尝试过试验BaseOutputPath属性:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Deployment|AnyCPU'">
  <BaseOutputPath>C:\Projects\xxx\</BaseOutputPath>
  <OutputPath>.\Deployment</OutputPath>
  <EnableUpdateable>true</EnableUpdateable>
  <UseMerge>true</UseMerge>
  <SingleAssemblyName>xxx.Web.Deployment</SingleAssemblyName>
Run Code Online (Sandbox Code Playgroud)

但它似乎被忽略了.BaseOutputPath和BaseIntermediateOutputPath用于什么?

Pau*_*els 5

我不确定你是否可以做你正在谈论的事情,但你可以添加类似于以下内容:

<PropertyGroup>  
    <CentralisedBinariesFolderLocation>c:\wherever</CentralisedBinariesFolderLocation>
</PropertyGroup>  

<Target Name="AfterBuild">
    <Exec Command="xcopy /Y /S /F /R &quot;$(TargetPath)&quot; &quot;$(CentralisedBinariesFolderLocation)&quot;" />
</Target>
Run Code Online (Sandbox Code Playgroud)

这将在构建后将其复制到相关位置.