RazorGenerator icon indicating copy to clipboard operation
RazorGenerator copied to clipboard

RazorGenerator.MsBuild not PreCompiling Views in Azure DevOps Build

Open bsulliva opened this issue 4 years ago • 2 comments

Hello, I'm using the latest RazorGenerator.MsBuild NuGet package and when I compile the MVC solution in Visual Studio I see the obj\CodeGen directory. However, when I run the build in Azure DevOps, which uses MSBUILD, I'm not seeing the obj\CodeGen directory. In the build solution step, I don't see anything in the logs related to "precompile". However, in the publish solution step, I do see this line: "Skipping target "PrecompileRazorFiles" because all output files are up-to-date with respect to the input files." How can I get the publish step to run PrecompileRazorFiles instead of skipping it?

bsulliva avatar Feb 05 '21 23:02 bsulliva

Do you have a <RazorViewsCodeGenDirectory> property in any of your .csproj, .props, or .targets files?

What happens if you do a command-line build (outside of Visual Studio) on your dev machine using the same build commands as Azure DevOps?

daiplusplus avatar Apr 01 '21 16:04 daiplusplus

@bsulliva One thing to check is that you are doing a nuget restore step in your build script. If not, you will be relying on restore on build, which won't bring in the package early enough for it to work. I think this is why you don't see it in your build step, but do in the publish step.

CZEMacLeod avatar Apr 05 '22 13:04 CZEMacLeod