Quantcast
Channel: RazorGenerator Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 525

Commented Issue: RazorGenerator.MsBuild fails to generate when using NuGet package restore and pacakges folder not in source control [87]

$
0
0
I think there is a Catch-22 when using Package Restore and the packages folder is not checked in. The initial install of RazorGenerator.MsBuild adds the "..\packages\**\tools\NuGet.import.targets" import to NuGet.targets, but when the packages folder is not checked in, the RazorGenerator NuGet.import.targets file does not yet exist when the build is initiated. Package restore pulls down the RazorGenerator.MsBuild package, which brings in the import targets file, but I think it it is too late in the build process.

This can be reproduced by installing the RazorGenerator.MsBuild package, deleting the packages folder, and then building the solution - view the build output at normal verbosity and verify that the PrecompileRazorFiles target is never invoked.

One potential solution is for the NuGet installation to add the RazorGenerator.targets file directly to the MVC project itself - then package restore is only responsible for pulling down the binaries.
Comments: I worked around the issue by following the pattern that the MSBuild Community Tasks NuGet package uses. 1. Create a top-level .razorgenerator solution folder 2. Copy the RazorGenerator.targets and RazorGenerator.MsBuild.dll files 3. Fix up .csproj import to point to the new location of the .targets file This allows the NuGet package restore to run before trying to build that project.

Viewing all articles
Browse latest Browse all 525

Trending Articles