MSBuild OutputPath属性和绝对路径

MSBuild OutputPath属性和绝对路径,msbuild,Msbuild,我正在尝试将OutputPath值设置为绝对路径: <OutputPath>c:\Projects\xxx\Deployment</OutputPath> 有没有方法将绝对路径与OutputPath属性一起使用?我尝试过BaseOutputPath属性: <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Deployment|AnyCPU'"> <BaseOutputPath&

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

<OutputPath>c:\Projects\xxx\Deployment</OutputPath>
有没有方法将绝对路径与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>

C:\Projects\xxx\
部署
真的
真的
xxx.Web.Deployment

但它似乎被忽视了。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>

c:\where

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

我不确定您是否能够做到您所说的,但您可以添加类似于以下内容的内容:

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

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

c:\where

将在生成后将其复制到相关位置。

尝试使用
OutDir
而不是
OutputPath

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Deployment|AnyCPU'">
  <OutDir>C:\Projects\xxx\$(Configuration)</OutDir>
  <EnableUpdateable>true</EnableUpdateable>
  <UseMerge>true</UseMerge>
  <SingleAssemblyName>xxx.Web.Deployment</SingleAssemblyName>
</PropertyGroup>

C:\Projects\xxx\$(配置)
真的
真的
xxx.Web.Deployment

尝试使用
OutDir
而不是
OutputPath

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Deployment|AnyCPU'">
  <OutDir>C:\Projects\xxx\$(Configuration)</OutDir>
  <EnableUpdateable>true</EnableUpdateable>
  <UseMerge>true</UseMerge>
  <SingleAssemblyName>xxx.Web.Deployment</SingleAssemblyName>
</PropertyGroup>

C:\Projects\xxx\$(配置)
真的
真的
xxx.Web.Deployment
  • 从安装程序目录复制.target和.dll文件
  • 修改顶部类似的行,并将这些.target和.dll文件复制到您正在编辑的复制的Microsoft.WebDeployment.targets文件*旁边的供应商文件夹中。设置属性,AssemblyFile=“Microsoft.Web.Publishing.Tasks.dll”
  • 将行True添加到初始的属性组
  • 在实际文件/other tagets/other build proj文件中设置所需的输出路径
  • 将第290行编辑为$(OutputPath)
  • 从安装程序目录复制.target和.dll文件
  • 修改顶部类似的行,并将这些.target和.dll文件复制到您正在编辑的复制的Microsoft.WebDeployment.targets文件*旁边的供应商文件夹中。设置属性,AssemblyFile=“Microsoft.Web.Publishing.Tasks.dll”
  • 将行True添加到初始的属性组
  • 在实际文件/other tagets/other build proj文件中设置所需的输出路径
  • 将第290行编辑为$(OutputPath)

  • 除了10月份答案中的所有步骤之外,是否可以仅使用与
    OutputPath
    相同的路径定义
    WebPublishPipelineProjectDirectory

    我在我的CI解决方案中尝试了它(使用
    CruiseControl
    ),它似乎很有效


    有人知道这样做有什么副作用对我来说并不明显吗?

    不是10月份答案中的所有步骤,难道不能用与
    OutputPath
    相同的路径定义
    WebPublishPipelineProjectDirectory

    我在我的CI解决方案中尝试了它(使用
    CruiseControl
    ),它似乎很有效


    有人知道这样做有什么副作用对我来说并不明显吗?

    我认为这也是一种方法。但我有一个小问题,$(TargetPath)什么也不返回。是否有其他变量可用于获取部署路径?已使用:。不是很优雅,但在我的情况下有效。如果有更好的办法,请告诉我!:)我想这也是一条路。但我有一个小问题,$(TargetPath)什么也不返回。是否有其他变量可用于获取部署路径?已使用:。不是很优雅,但在我的情况下有效。如果有更好的办法,请告诉我!:)我尝试了这个,它输出到
    C:\Projects\xxx\$(配置)\\u PublishedWebsites\MyApp.Website
    。我尝试了这个,它输出到
    C:\Projects\xxx\$(配置)\\u PublishedWebsites\MyApp.Website