Publish Web Deploy using VS Code

后端 未结 3 1926
一整个雨季
一整个雨季 2021-02-01 03:41

In Visual Studio, I use the \"publish web\" feature to do some web.config transforms, and publish a WebAPI project to our server. The publishing is done using Web Deploy.

<
3条回答
  •  深忆病人
    2021-02-01 04:35

    In order to publish using MSBuild you need to use the following command:

    msbuild  /p:DeployOnBuild=true /p:PublishProfile=
    
    • You can point to a solution, this will publish ALL the projects that includes a valid Publish Profile:

      msbuild \MySolution.sln /p:DeployOnBuild=true /p:PublishProfile=Test
      
    • You can point to a specific project like this:

      msbuild \Project1\MyProj.csproj /p:DeployOnBuild=true /p:PublishProfile=Test
      
    • In both cases you can also specify use the full path to the .pubxml file:

      msbuild \MySolution.sln /p:DeployOnBuild=true /p:PublishProfile=\PublishProfiles\Test.pubxml
      

    In fact the *.pubxml files are MSBuild scripts, so you can interact with it like you do with any other MSBuild script, for example you can replace the properties from the command line like this:

    Test.pubxml

    
        
            FileSystem
            Release
            Any CPU
            
            False
            C:\Deploy\MyProject\
            True
        
    
    
        msbuild \MySolution.sln /p:DeployOnBuild=true /p:PublishProfile=\PublishProfiles\Test.pubxml /p:publishUrl:"D:\DifferentPath\DifferentFolder\"
    

    You can use these commands from your continuous integration server or any other build scripts.

    Additional information:

    Command Line Deployment

提交回复
热议问题