How do I create a deployment package with my publish profile settings? RRS feed

  • Question

  • User16290778 posted

    I cant understand why this is so inconsistent.

    I can do this to package and deploy in one step:

    msbuild myapp.sln /p:DeployOnBuild=true;PublishProfile=myprofile

    The publish profile includes which server to deploy to and it just works with these settings in the publish profile:


    Now I want to create a package and deploy it in a separate step

    So I run this to create the package (need to specify the project instead of the solution- first weird inconsistency)

    msbuild myapp.sln /T:Package /p:PublishProfile=myprofile;PackageLocation="mypackage.zip"

    Now my expectation is the package has all my publish profile settings in it (like the server to deploy to) but it does not!

    Doing this is fails with "site does not exist" error:

    mypackage.deploy.cmd -allowUntrusted /U:myuser /P:mypass"

    I have to plugin the name of the server manually:

    mypackage.deploy.cmd -allowUntrusted /U:myuser /P:mypass /M:myserver

    Thats dumb, its already in my config is there a way to have the script use whats in the publish profile? Why is it I have one simple command to package AND deploy but not separate commands to package THEN deploy?

    Edit: so its also not getting <EnableMSDeployAppOffline>true</EnableMSDeployAppOffline> from my publish profile either

    Wednesday, March 28, 2018 4:13 PM

All replies

  • User283571144 posted

    Hi red888,

    As far as I know, if select web deploy package, the profile will not contain the deployed server path and DeployIisAppPath.

    If you don't select the DeployOnBuild it will not read the server path when you use mypackage.deploy.cmd.

    Its profile is as below:

    <?xml version="1.0" encoding="utf-8"?>
    This file is used by the publish/package process of your Web project. You can customize the behavior of this process
    by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. 
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
        <SiteUrlToLaunchAfterPublish />
          <Objects xmlns="" />

    Best Regards,


    Wednesday, April 4, 2018 2:24 AM