pwind
pwind

Reputation: 441

Azure devops pipeline - Visual studio build step - How to precompile cshtml views?

We have a devops setup in which we use the "Visual studio build step" to build our solution. I have searched high and low to find out how to ensure that our cshtml views are precompiled as part of the build task, but I haven't found a solution.

Our solution is standard .Net 4.7.2 using MVC.

Our build step looks as below: enter image description here

Upvotes: 3

Views: 1777

Answers (1)

Hugh Lin
Hugh Lin

Reputation: 19451

Try to add /p:PrecompileBeforePublish=true to MSBuild Arguments:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.stagingDirectory)" /p:PrecompileBeforePublish=true

Upvotes: 3

Related Questions