_CopyWebApplication with web.config transformations

前端 未结 1 1948
一整个雨季
一整个雨季 2020-12-04 14:24

I am trying to have my web application automatically Publish when a Release build is performed. I\'m doing this using the _CopyWebApplication target. I added the following t

相关标签:
1条回答
  • 2020-12-04 15:12

    I've been hitting my head against the wall for this. After hiking through the MSBuild targets I've come across something very "opaque".

    Long story short: Try using the new _WPPCopyWebApplication. It works on my machine. The old _CopyWebApplication does not support transformations for legacy reasons. This is what I do:

    msbuild /t:Rebuild /p:OutDir=..\publish\;Configuration=Release;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False MvcApplication1\MvcApplication1.csproj
    
    # UseWPP_CopyWebApplication = true requires PipelineDependsOnBuild = false
    

    Long story:

    Have a look at VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets. It's so wrong. Find _CopyWebApplication in line 70. The comment is:

    The original _CopyWebApplication is now a Legacy, you can still use it by setting $(UseWPP_CopyWebApplication) to true. By default, it now change to use _WPPCopyWebApplication target in Microsoft.Web.Publish.targets. It allow to leverage the web.config trsnaformation. [all sic]

    Uh oh. UseWPP_CopyWebApplication defaults to false (line 27) which makes sense if you don't want to break the existing _CopyWebApplication. So setting it to true will actually use the new WPP stuff introduced to VS 2010. I prefer this over calling a "hidden" target.

    0 讨论(0)
提交回复
热议问题