Skip to content

Commit 8443693

Browse files
committed
Automatically build the cshtml in the test project
1 parent b66864d commit 8443693

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

MSBuildRazorCompiler/CompileRazorFiles.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<!-- https://natemcmaster.com/blog/2017/11/11/build-tools-in-nuget/ -->
22
<Project>
33
<PropertyGroup>
4-
<MSBuildRazorCompilerExe>dotnet "$(MSBuildThisFileDirectory)/netcoreapp3.1/MSBuildRazorCompiler.dll"</MSBuildRazorCompilerExe>
4+
<BuildPath Condition="'$(BuildPath)' == ''">$(MSBuildThisFileDirectory)</BuildPath>
5+
<MSBuildRazorCompilerExe>dotnet "$(BuildPath)netcoreapp3.1\MSBuildRazorCompiler.dll"</MSBuildRazorCompilerExe>
56
<MsBuildRazorCompilerPath>$(MSBuildProjectDirectory)</MsBuildRazorCompilerPath>
67
<MsBuildRazorCompilerRootNamespace>$(RootNamespace)</MsBuildRazorCompilerRootNamespace>
78
</PropertyGroup>

Test/Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<PreserveCompilationContext>true</PreserveCompilationContext>
7+
<BuildPath>$(MSBuildThisFileDirectory)..\MSBuildRazorCompiler\bin\$(Configuration)\</BuildPath>
78
</PropertyGroup>
89

910
<ItemGroup>
@@ -19,4 +20,6 @@
1920
<ProjectReference Include="..\RazorRenderer\RazorRenderer.csproj" />
2021
</ItemGroup>
2122

23+
<Import Project="../MSBuildRazorCompiler/CompileRazorFiles.targets" />
24+
2225
</Project>

0 commit comments

Comments
 (0)