Could not create web deploy package via MSBuild command line RRS feed

  • Question

  • I've tried several different commands and versions of MSBuild but I still can't generate a Web deploy package via MSBuild. But I could create that via Visual Studio 2017 using the same solution and pubxml file.

    Below are the commands I have tried:


    I must be missing something in command line but I don't know what. Thanks in advance.

    Sunday, March 11, 2018 3:57 PM


  • Hi Justyna.lyu2,

    Thanks for posting here.

    The type of project you are deploying should be the WebSite. The publish process of website project is not plumbed into the build process. When you create 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. So publish file should be website.publishproj rather than WebSite1.sln file. So the publish command line should be:

    msbuild.exe "website.publishproj" /p:DeployOnBuild=true /p:PublishProfile=FolderProfile /p:PackageLocation="D:\LocalServer\web1.zip" /T:Package /p:PackageAsSingleFile=true /p:WebPublishMethod=Package
    Hope this helps.

    MSDN Community Support Please remember to click Mark as Answer. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 12, 2018 1:41 AM