4 Jul 2015

9 Comments

The _PublishedWebsite folder is missing in 2015

“Where has the _PublishedWebsite folder gone in 2015?” This is a common question I have been seeing from people that have started using Visual Studio 2015 and the new Team Build 2015.

If you’ve been building web applications using Team Foundation Server 2013 or earlier, you’ll know that a folder named _PublishedWebsite is automatically created and copied to the Drop folder specified in your build definition. This has allowed us to easily write scripts to simply copy the content to a folder on our IIS server.

PublishedWebsites

If you create a new Build Definition using Visual Studio 2015 and Team Build 2015, you will notice that not only is this folder no longer created by default but when you look in the drop folder you may only see the BIN directory and none of the website content at all.

If you’re keen to have the well-loved _PublishedWebsites folder created in 2015, it is a very simple thing to fix. All you need to do is add the following text into the MSBuild arguments field in the General tab of your Build definition.

/p:OutDir=$(build.stagingDirectory)

This is what it looks like in added to the MSBuild Arguments field in the General tab of the build definition.

MSBuildArguments

Now when you trigger your build, the folder and all of its content is there, just like it has been in the past. If you want to copy the contents of the _PublishedWebsites folder, you can specify the copy source as $(Agent.BuildDirectory)\Staging\_PublishedWebsites

PublishedWebsitesReturn

DevOpsTraining

  • Hi Anthony,

    as this is my first comment, I would like to thank you for all the nice videos on MVA.

    I am getting on board of VS2015 and TFS2015. What I saw, aside the problem you describe is the following; If you create a Web Application with VS 2015 and build it via a build server (no matter if XAML or vNext build), the roslyn folder inside your build directory is not present. This however has to do more with msbuild (project files) itself than a build pipeline. Still, you may encountered this problem and if so, maybe you are willing to share also that tip with us.

    Thanks

  • Daniel Steenwyk

    I am having the same problem: If you create a Web Application with VS 2015 and build it via a build server (no matter if XAML or vNext build), the roslyn folder inside your build directory is not present.

  • Graham Smith

    Thought it might be worth pointing out that if you do use /p:OutDir=$(build.stagingDirectory) in MSBuild Arguments you’ll need to consider other tasks that might need to get to the build content. I found that in Visual Studio Test my tests stopped working and I had to prefix Test Assembly with $(build.stagingDirectory) so the task could find them.

    • Good tip Graham. Thanks for sharing it.

      • Monish

        can you help with where exactly this setting is made?

  • Ole Sjøbakken

    I have been trying a similar approach to publish my web project (wcf) to the dropfolder, but with no luck. The web.config files are not transformed in the same way as the publish profiles was working on tfs 2013. Another issue is that the folder structure inside the _publishedwebsites is flattened out/removed. Why is that?

  • Kasey Davis

    Any ideas why when I run my build the aspnet compiler ends up concatenating the ‘a’ subfolder with my ‘_PublishedWebsites’ folder. The resulting line for me in my build log ends up looking like C:WindowsMicrosoft.NETFramework64v2.0.50727aspnet_compiler.exe -v /TranService.Host -p TestsTranService.Host -u -f C:BuildAgent_work5a_PublishedWebsitesTranService.Host
    My front-end application creates the _PublishedWebsites folder as a subfolder of ‘a’, but the the same switches on the Service solution is merging the foldernames…

    • Kasey Davis

      Well it turns out if I use the MSBuild argument /p:OutDir=$(build.stagingDirectory) {note the explicit trailing slash} then it will force a backslash between the ‘a’ directory and the ‘_PublishedWesites’ folder. While this works, it seems like I probably have a configuration issue somewhere else necessitating this adjustment to the default build.StagingDirectory value.

      • Hi Kasey,
        You will see that there are in fact three folder created with single letter names.
        a = “artefact”
        b = “binaries”
        s = “sources”
        You can see in my screenshot above that the directory “staging” was shown. Microsoft decided to change the names to their one letter abbreviation to reduce the number of characters in the path.

        The default build.StagingDirectory variable should point to a directory on disk where you can place build outputs or other temporary data, it will be cleaned up between builds. By default build.StagingDirectory returns $(Agent.BuildDirectory)a which is where your letter “a” is coming from.
        Cheers
        Anthony