Skip to content

Commit d574835

Browse files
committed
Got it (mostly) working end-to-end via a nuget package (as long as you add in the RazorLight reference yourself
1 parent ab6bb00 commit d574835

5 files changed

Lines changed: 19 additions & 4 deletions

File tree

MSBuildRazorCompiler/CompileRazorFiles.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<MsBuildRazorCompilerRootNamespace>$(RootNamespace)</MsBuildRazorCompilerRootNamespace>
77
</PropertyGroup>
88

9-
<Target Name="CompileRazorFiles" BeforeTargets="Build">
10-
<Exec Command="$(MSBuildRazorCompilerExe) ""$(MsBuildRazorCompilerPath)"" $(RootNamespace)" />
9+
<Target Name="CompileRazorFiles" BeforeTargets="CoreCompile">
10+
<Exec Command="$(MSBuildRazorCompilerExe) &quot;$(MsBuildRazorCompilerPath)&quot; $(RootNamespace)" />
1111
</Target>
1212
</Project>

MSBuildRazorCompiler/MsBuildRazorCompiler.nuspec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
<version>1.0.0</version>
66
<authors>Robert Moore, Matt Davies, MRCollective</authors>
77
<description>MSBuild target to statically compile .cshtml files on build of your project and then provide the code to render them at runtime.</description>
8+
<!-- todo: For some reason the following isn't added automatically, and on restore it adds 1.0.0 of RazorLight for some reason -->
9+
<dependencies>
10+
<group targetFramework=".NETCoreApp3.1">
11+
<dependency id="RazorLight" version="2.0.0-beta7" />
12+
</group>
13+
</dependencies>
814
</metadata>
915
<files>
1016
<file src="..\RazorRenderer\bin\Release\netcoreapp3.1\*.*" target="lib/netcoreapp3.1/" />

MSBuildRazorCompiler/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"MSBuildRazorCompiler": {
44
"commandName": "Project",
5-
"commandLineArgs": "c:\\dev\\oss\\MSBuildRazorCompiler\\Test Test"
5+
"commandLineArgs": "$(SolutionDir)Test Test"
66
}
77
}
88
}

Test/Test.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,13 @@
1010
<FrameworkReference Include="Microsoft.AspNetCore.App" />
1111
</ItemGroup>
1212

13+
<ItemGroup>
14+
<PackageReference Include="razorlight" Version="2.0.0-beta7" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<ProjectReference Include="..\MSBuildRazorCompiler\MSBuildRazorCompiler.csproj" />
19+
<ProjectReference Include="..\RazorRenderer\RazorRenderer.csproj" />
20+
</ItemGroup>
21+
1322
</Project>

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
& dotnet build --configuration Release
2-
& dotnet pack MSBuildRazorCompiler/MSBuildRazorCompiler.csproj --output ./ --configuration Release
2+
& dotnet pack MSBuildRazorCompiler/MSBuildRazorCompiler.csproj --output ./ --configuration Release --include-symbols

0 commit comments

Comments
 (0)