MSBuild OutputPath 属性和绝对路径

2023-11-26

我试图将 OutputPath 值设置为绝对路径:

<OutputPath>c:\Projects\xxx\Deployment</OutputPath>

但我收到这个错误:

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

有没有办法将绝对路径与 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>

但似乎被忽视了。 BaseOutputPath 和 BaseIntermediateOutputPath 的用途是什么?


我不确定您是否可以执行您所说的操作,但您可以添加类似于以下内容的内容:

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

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

构建后会将其复制到相关位置。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

MSBuild OutputPath 属性和绝对路径 的相关文章

随机推荐