How to use MsBuild MsDeployPublish to target local file system?

后端 未结 3 1734
半阙折子戏
半阙折子戏 2021-01-29 19:38

I\'m trying to replicate the Visual Studio 2010 \"Publish...\" command (applicable to Web Application projects) where I would in the UI choose Publish Method: \"File System\".

3条回答
  •  北海茫月
    2021-01-29 20:36

    As per my answer from Using MSBuild, how do I build an MVC4 solution from the command line (applying Web.config transformations in the process) and output to a folder?

    msbuild ProjectFile.csproj /p:Configuration=Release ^
                               /p:Platform=AnyCPU ^
                               /t:WebPublish ^
                               /p:WebPublishMethod=FileSystem ^
                               /p:DeleteExistingFiles=True ^
                               /p:publishUrl=c:\output
    

    Or if you are building the solution file:

    msbuild Solution.sln /p:Configuration=Release ^ 
                         /p:DeployOnBuild=True ^
                         /p:DeployDefaultTarget=WebPublish ^
                         /p:WebPublishMethod=FileSystem ^
                         /p:DeleteExistingFiles=True ^
                         /p:publishUrl=c:\output
    

    You can also target the project via the solution using the /t:SolutionFolder/Project:Target syntax:

    msbuild Solution.sln /t:SolutionFolder/ProjectFile:WebPublish ^
                         /p:Configuration=Release ^ 
                         /p:WebPublishMethod=FileSystem ^
                         /p:DeleteExistingFiles=True ^
                         /p:publishUrl=c:\output
    

提交回复
热议问题