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?

后端 未结 1 1025
没有蜡笔的小新
没有蜡笔的小新 2020-12-28 21:45

I think the question title pretty much said it all, but for clarity, I am trying to:

  1. Build a VS2010 ASP.NET MVC4 solution from the command line (MSBuild), spe
相关标签:
1条回答
  • 2020-12-28 22:40

    If you are running VS2010: ensure you have the Azure 1.7+ SDK installed (even if you're not publishing to Azure, it adds the VS2012 publishing features to VS2010)

    VS2012+ have these featured built in

    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
    

    Either way, you can also set /p:PrecompileBeforePublish=true and the output will be a precompiled version of the site.

    Once you have the Azure SDK installed you would usually create a publish profile and simply use /p:PublishProfile=DeployToFolder but I've given you the manual command line in case you're not interested in going all-in with the new publishing stuff.

    0 讨论(0)
提交回复
热议问题