Web部署项目/MSBuild-TempBuildDir

Web部署项目/MSBuild-TempBuildDir,msbuild,web-deployment-project,Msbuild,Web Deployment Project,使用MSBuild时,在执行生成时使用文件夹“.TempBuildDir”。是否可以指定替代文件夹 在C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0或v10.0目录中,是Microsoft.WebDeployment.targets文件,其中TempBuildDir属性在_PrepareForBuild目标中定义 因为他们使用CreateProperty任务来设置TempBuildDir,所以即使属性已经存在,也总是将其设置为硬编码值。

使用MSBuild时,在执行生成时使用文件夹“.TempBuildDir”。是否可以指定替代文件夹

在C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0或v10.0目录中,是Microsoft.WebDeployment.targets文件,其中TempBuildDir属性在_PrepareForBuild目标中定义

因为他们使用CreateProperty任务来设置TempBuildDir,所以即使属性已经存在,也总是将其设置为硬编码值。这可能是为了消除有人将TempBuildDir属性用于其他内容并破坏构建的问题

您必须更改Microsoft.WebDeployment.targets文件以使用不同的临时目录

警告:以下内容正在更改您无法控制的文件,因此使用风险由您自己承担

如果要从更改_PrepareForBuild目标中的以下行

  <CreateProperty Value=".\TempBuildDir\">
    <Output TaskParameter="Value" PropertyName="TempBuildDir" />
  </CreateProperty>


然后在项目文件中设置MySpecialWebTempBuildDir属性,它应该覆盖它。如果您没有设置MySpecialWebTempBuildDir,那么它将像以前一样使用TempBuildDir


如果安装web部署包的更新,您所做的更改将被覆盖。

在C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0或v10.0目录中,是Microsoft.WebDeployment.targets文件,其中TempBuildDir属性在_PrepareForBuildTarget中定义

因为他们使用CreateProperty任务来设置TempBuildDir,所以即使属性已经存在,也总是将其设置为硬编码值。这可能是为了消除有人将TempBuildDir属性用于其他内容并破坏构建的问题

您必须更改Microsoft.WebDeployment.targets文件以使用不同的临时目录

警告:以下内容正在更改您无法控制的文件,因此使用风险由您自己承担

如果要从更改_PrepareForBuild目标中的以下行

  <CreateProperty Value=".\TempBuildDir\">
    <Output TaskParameter="Value" PropertyName="TempBuildDir" />
  </CreateProperty>


然后在项目文件中设置MySpecialWebTempBuildDir属性,它应该覆盖它。如果您没有设置MySpecialWebTempBuildDir,那么它将像以前一样使用TempBuildDir


如果您安装web部署包的更新,您的更改将被覆盖。

另一个解决方案是取消注释并覆盖web部署项目的“BeforeBuild”目标,如下所示:

<Target Name="BeforeBuild">
<CreateProperty Value=".\TempBuildDirDebug\" Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  <Output TaskParameter="Value" PropertyName="TempBuildDir" />
</CreateProperty>
<CreateProperty Value=".\TempBuildDirRelease\" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  <Output TaskParameter="Value" PropertyName="TempBuildDir" />
</CreateProperty> 


另一种解决方案是取消注释并覆盖web部署项目的“BeforeBuild”目标,如下所示:

<Target Name="BeforeBuild">
<CreateProperty Value=".\TempBuildDirDebug\" Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  <Output TaskParameter="Value" PropertyName="TempBuildDir" />
</CreateProperty>
<CreateProperty Value=".\TempBuildDirRelease\" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  <Output TaskParameter="Value" PropertyName="TempBuildDir" />
</CreateProperty>