Visual Studio 2012 Web Publish doesn't copy files

I have a Web Application project in VS 2012 and when I use the web publishing tool it builds successfully but doesn't copy any files to the publish target (File System in this case).

If I look at the build output I can see everything gets copied over to objReleasePackagePackageTmp correctly but then all I see in the build output is this:

4>Done building project "{Project}.csproj".
4>Deleting existing files...
4>Publishing folder /...
4> ========== Build: 3 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

Even though it says the publish succeeded there are not files in the target directory for the publish.

I have seen this in multiple projects and sometimes it seems like the Solution/Platform configurations cause this problem but I haven't been able to pinpoint an exact cause for this.

Has anyone else seen this happening or have an idea on how to get this working correctly?

UPDATE:

I may have found a workaround for this. I just had this happen again and I was messing around with the publish settings. Once I changed the selected Configuration on the Settings tab away to another configuration and then back to the one I wanted to use all my files started publishing again. Hopefully this works on other projects in the future.

UPDATE 2:

I posted a bug on Microsoft Connect and heard back from a developer on the VS Web Developer team. He said they have fixed this issue in their internal builds and will releasing an update to the publish tool soon that will fix this problem.

UPDATE 3:

This has been recently fixed with Visual Studio 2012 Update 2


This may be caused by solutions/projects that were created with the RC of vs2012. This happened to me months ago and fixed the problem by making sure my solution build configurations matched my project configurations...

I just recently experienced the same problem when opening the same solution originally created in vs2012RC with VS2012 Express for Web. I did exactly what the original poster suggested and it fixed my problem.

Here is the thread that lead me to the answer:

connect.microsoft.com/VisualStudio/feedback/details/746321/publish-web-application-fails

The pertinent response from the conversation above that helped me was:

Posted by Microsoft on 6/13/2012 at 12:00 PM Hi Andrew,

This was a bug in how we handle the solution configuration vs. the project configuration. We incorrectly assumed that they would be the same (eg Solution's Release|x86 would have each project set to Release|x86 as well), which caused us to use the wrong build properties for publishing files.

The workaround is to make the solution configuration and build configuration match. This issue will be fixed in the next release of Visual Studio 2012.

Thanks, - Jimmy Lewis SDET, Visual Web Developer team


Same problem. The workaround was changing the publish settings from Release to Debug. Re-publish and then change back to Release...


To take this a bit further. You have two files that are created when you create a publish profile.

  • NewProfile.pubxml
  • NewProfile.pubxml.user
  • When you open a project that has these files in the PublishProfile folder from a source control it only has the .pubxml file and not the .publxml.user file, so it creates the .publxml.user file on the fly when you open the project. When it creates the new .publxml.user on the fly the xml looks like:

    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    </Project>
    

    When you create a new profile it creates xml that looks like:

    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
        <TimeStampOfAssociatedLegacyPublishXmlFile />
        <EncryptedPassword />
      </PropertyGroup>
    </Project>
    

    If you take the <PropertyGroup> node and put it in the .pubxml.user file your PublishProfiles will start working again.

    链接地址: http://www.djcxy.com/p/61884.html

    上一篇: Windows 8 Metro Flyouts在Javascript中似乎不起作用?

    下一篇: Visual Studio 2012 Web发布不复制文件