Publish Profile not working when building website project

落花浮王杯 提交于 2019-12-05 02:11:54

I have spent about 3 weeks wrestling with this in my own environment and think I have a solution.

I think the issue is that the website.publishproj file is never actually built when you pass in the solution. I managed to resolve this by doing the following:

  1. Please make sure you are using the new ASP.Net and Tools 2012.2 update. Download Here.
  2. Create a file next to the solution file called after.MyWebs.sln.targets. This file should look as follows:

    <!--?xml version="1.0" encoding="utf-8"?-->
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <Target Name="Deploy Website" AfterTargets="Build">
            <Message Text="Starting Website deployment" Importance="high">
            </Message>
            <MSBuild Projects="$(MSBuildProjectDirectory)\MyWebs\website.publishproj" 
            BuildInParallel="true" /> 
        </Target>
    </Project>
    

What this does is that when MSBuild starts building the solution file, it actually creates an MSBuild file in memory with the extension metaproj. There are ways to get MSBuild to save this file to disk so that you can inspect it but that is easily found on google. The file created in step one is injected into the metaproj file and is run after the build.

This was the only way I could get the new Publish Profiles to give me the output that I used to get with the old Web Deployment Propjects.

Word of warning: If you want to use this in a TFS build, then in this scenario, you will get a _PublishedWebsites folder in the drop location independent of the PublishUrl you specify in the pubxml file. This is something I am trying to resolve but so far, not having much joy.

I had the exact same problem as above. I deleted following key and Automated build started working fine.

**<Content Include="website.publishproj" />**
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!