3

I am trying to setup Continuations Integration for an old project.

The project still uses websites and not web applications. In Visual studio i created the publish profile. I just want it to publish it to an local folder with in the solution.

It works great when i publish from within Visual studio but as soon as I run MSbuild command then it creates a PrecompiledWeb folder and places the code in there.

And this causes my build artifacts to fail as soon as i try and setup my CI

This is my publish profile setup

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>.\Publish</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <PrecompileBeforePublish>False</PrecompileBeforePublish>
  </PropertyGroup>
</Project>

I even tried to set the PrecompileBeforePublish to false. But that also did not work.

My MSBuild command

c:\development\projectname>msbuild project.sln /p:deployOnBuild=true /p:publishProfile=projectFileSystem
R4nc1d
  • 2,923
  • 3
  • 24
  • 44

1 Answers1

5

It works great when i publish from within Visual studio but as soon as I run MSbuild command then it creates a PrecompiledWeb folder and places the code in there.

The website project the publish process is not plumbed into the build process. For website project since there is no formal build process there was nothing for us to really extend.

After creating a publish profile in VS the following are created:

1) A publish profile (.pubxml file) under App_Data/PublishProfiles

2) A website.publishproj in the root of the website

The purpose of the website.publishproj is to facilitate command line publishing. Then you can try to use command like the following:

C:\Program Files (x86)\Microsoft Visual Studio 14.0>msbuild "C:\Users\UserName\Documents\Visual Studio 2015\WebSites\WebSite1\website.publishproj" /p:deployOnBuild=true /p:publishProfile=WebsiteTestDemo /p:VisualStudioVersion=14.0

enter image description here

After that, you will noticed it does not create the PrecompiledWeb folder and the publish uses the setting in the profile:

enter image description here

Note:The publish file should be website.publishproj rather than WebSite1(1).sln file.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135