Skip to content

Commit 23199f7

Browse files
authored
Allow RazorLibrary to be used as secondary SDK.
* Add option to disable `RazorGenerator.MVC` * Move `System.Web` reference into `DefaultPackages` * Use newer SDKs * Update package versions and documentation
1 parent 32f72db commit 23199f7

14 files changed

Lines changed: 59 additions & 40 deletions

Directory.Build.Targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<PackagePath>$([MSBuild]::ValueOrDefault('%(Content.PackagePath)', 'content\%(Identity)'))</PackagePath>
6161
</_Temporary>
6262
</ItemGroup>
63-
<Message Text="Updating Version of %(_Temporary.Identity) [%(_Temporary.SourceGroup)]" Importance="high" />
63+
<Message Text="Updating Version of %(_Temporary.Identity) [%(_Temporary.SourceGroup)]" Importance="high" Condition="@(_Temporary->Count())!=0" />
6464
<WriteLinesToFile
6565
File="%(_Temporary.VersionedFile)"
6666
Lines="$([System.IO.File]::ReadAllText('%(_Temporary.SourceFile)').Replace('$version$','$(Version)'))"

azure-pipelines.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,18 @@ steps:
9595
secureFile: '61ad38e7-05ff-4421-aea8-e3241b75c7a1'
9696

9797
- task: NuGetToolInstaller@1
98-
displayName: 'Use NuGet >=6.6.1'
98+
displayName: 'Use NuGet >=7.3.0'
9999
inputs:
100-
versionSpec: '>=6.6.1'
100+
versionSpec: '>=7.3.0'
101101
checkLatest: true
102102

103+
- task: UseDotNet@2
104+
displayName: 'Use .NET SDK'
105+
inputs:
106+
packageType: 'sdk'
107+
useGlobalJson: true
108+
installationPath: $(Agent.ToolsDirectory)/dotnet
109+
103110
# Install the code signing tool
104111
- task: DotNetCoreCLI@2
105112
inputs:

docs/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ For more information, [read the documentation](https://docs.microsoft.com/visual
6060
MSBuild 15.0 introduced new project XML for .NET Core that we refer to as SDK-style. These SDK-style projects looks like:
6161

6262
```xml
63-
<Project Sdk="Microsoft.NET.Sdk">
63+
<Project Sdk="MSBuild.SDK.SystemWeb">
6464
<PropertyGroup>
6565
<TargetFramework>net48</TargetFramework>
6666
</PropertyGroup>
@@ -70,14 +70,14 @@ MSBuild 15.0 introduced new project XML for .NET Core that we refer to as SDK-st
7070
At evaluation time, MSBuild adds implicit imports at the top and bottom of the project like this:
7171

7272
```xml
73-
<Project Sdk="MSBuild.SDK.SystemWeb">
74-
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
73+
<Project>
74+
<Import Project="Sdk.props" Sdk="MSBuild.SDK.SystemWeb" />
7575

7676
<PropertyGroup>
7777
<TargetFramework>net48</TargetFramework>
7878
</PropertyGroup>
7979

80-
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
80+
<Import Project="Sdk.targets" Sdk="MSBuild.SDK.SystemWeb" />
8181
</Project>
8282
```
8383

docs/RazorLibrary.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ Where `xx` is the latest release available on [nuget.org](https://nuget.org/pack
3232

3333
You can also use the [templates](../MSBuild.SDK.SystemWeb.Templates) to easily create new projects.
3434

35+
It is possible to mix this SDK with e.g. `MSBuild.SDK.SystemWeb` to allow pre-compiling the razor views during build.
36+
```xml
37+
<Project Sdk="MSBuild.SDK.SystemWeb/4.0.xx">
38+
39+
<Sdk Name="MSBuild.SDK.SystemWeb.RazorLibrary" Version="4.0.xx" />
40+
41+
</Project>
42+
```
43+
For this to work correctly, please ensure you are using MSBuild.SDK.SystemWeb.RazorLibrary versions >4.0.106
44+
3545
## Documentation
3646

3747
For more information see
@@ -58,6 +68,7 @@ For more information see
5868
| `MvcBuildViews` | true if Configuration is Release<br/>false otherwise | Whether to invoke the AspNetCompiler automatically after build |
5969
| `EnableWebFormsDefaultItems` | Same as `EnableDefaultItems` | Whether to automatically include WebForms files as content<br><ul><li> *.asax</li><li> *.ascx</li><li> *.ashx</li><li> *.asmx</li><li> *.aspx</li><li> *.master</li><li> *.svc</li></ul> |
6070
| `OverwriteAppConfigWithBindingRedirects` | false | If set, then any [automatically generated binding redirects](Binding_Redirects/Autogenerating-Binding-Redirects.md) will be copied into your web.config and `RazorAppConfigFiles` files. |
71+
| `EnableRazorGeneratorMVC` | true | If set, then the `RazorGenerator.MVC` package will automatically be added to your project. This will automatically register the contained views when consumed by an application. |
6172

6273
### Deprecated Properties
6374

@@ -71,7 +82,7 @@ For more information see
7182

7283
| Package | Default Version | Property |
7384
| ------- | --------------- | -------- |
74-
| `Microsoft.Net.Compilers.Toolset` | 4.5.0 | `MicrosoftNetCompilersToolset_Version` |
85+
| `Microsoft.Net.Compilers.Toolset` | 5.0.0 | `MicrosoftNetCompilersToolset_Version` |
7586
| `Microsoft.CodeDom.Providers.DotNetCompilerPlatform` | 3.6.0 | `MicrosoftCodeDomProvidersDotNetCompilerPlatform_Version` |
7687

7788
### Specific Packages
@@ -80,7 +91,7 @@ For more information see
8091
| ------- | --------------- | -------- |
8192
| `RazorGenerator.MsBuild` | 2.5.0 | `RazorGeneratorMSBuild_Version` |
8293
| `RazorGenerator.MVC` | 2.4.9 | `RazorGeneratorMVC_Version` |
83-
| `Microsoft.AspNet.Mvc` | 5.2.9 | `MicrosoftAspNetMvc_Version` |
94+
| `Microsoft.AspNet.Mvc` | 5.3.0 | `MicrosoftAspNetMvc_Version` |
8495

8596
## Items
8697

docs/SDK.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ Where `xx` is the latest release available on [nuget.org](https://nuget.org/pack
6565

6666
| Package | Default Version | Property |
6767
| ------- | --------------- | -------- |
68-
| `Microsoft.Net.Compilers.Toolset` | 4.5.0 | `MicrosoftNetCompilersToolset_Version` |
68+
| `Microsoft.Net.Compilers.Toolset` | 5.0.0 | `MicrosoftNetCompilersToolset_Version` |
6969
| `Microsoft.CodeDom.Providers.DotNetCompilerPlatform` | 3.6.0 | `MicrosoftCodeDomProvidersDotNetCompilerPlatform_Version` |

global.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"sdk": {
3-
"version": "6.0.100",
3+
"version": "8.0.100",
44
"rollForward": "latestMajor",
55
"allowPrerelease": true
66
},
77
"msbuild-sdks": {
88
"Microsoft.Build.NoTargets": "2.0.1",
9-
"MSBuild.SDK.SystemWeb": "4.0.97",
10-
"MSBuild.SDK.SystemWeb.RazorLibrary": "4.0.97"
9+
"MSBuild.SDK.SystemWeb": "4.0.106",
10+
"MSBuild.SDK.SystemWeb.RazorLibrary": "4.0.106"
1111
}
1212
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup Condition="'$(ExcludeSDKDefaultPackages)'=='false'">
3-
<MicrosoftNetCompilersToolset_Version Condition="'$(MicrosoftNetCompilersToolset_Version)'==''">4.5.0</MicrosoftNetCompilersToolset_Version>
3+
<MicrosoftNetCompilersToolset_Version Condition="'$(MicrosoftNetCompilersToolset_Version)'==''">5.0.0</MicrosoftNetCompilersToolset_Version>
44
<MicrosoftCodeDomProvidersDotNetCompilerPlatform_Version Condition="'$(MicrosoftCodeDomProvidersDotNetCompilerPlatform_Version)'==''">3.6.0</MicrosoftCodeDomProvidersDotNetCompilerPlatform_Version>
55
</PropertyGroup>
66
</Project>

src/MSBuild.SDK.SystemWeb.CommonFiles/Sdk/MSBuild.SDK.SystemWeb.Common.DefaultPackages.targets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
<!-- Include compilers unless ExcludeSDKDefaultPackages property is set -->
1515
<ItemGroup Condition="'$(ExcludeSDKDefaultPackages)'=='false'">
16-
<PackageReference Include="Microsoft.Net.Compilers.Toolset" PrivateAssets="All" GeneratePathProperty="true"/>
16+
<PackageReference Include="Microsoft.Net.Compilers.Toolset" PrivateAssets="All" GeneratePathProperty="true" />
1717
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" />
18+
19+
<Reference Include="System.Web" />
1820
</ItemGroup>
1921

2022
<!-- Set package versions if ApplySDKDefaultPackageVersions is true -->

src/MSBuild.SDK.SystemWeb.RazorLibrary/Sdk/MSBuild.SDK.SystemWeb.RazorLibrary.BindingRedirects.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<_ConfigFileHash Include="@(_DllConfigFileHash)" />
2020
<_ConfigFileHash Include="@(_AppConfigFileHash)" />
2121
</ItemGroup>
22-
<Message Text="%(_ConfigFileHash.Identity): %(_ConfigFileHash.FileHash)" Importance="high" />
22+
<Message Text="%(_ConfigFileHash.Identity): %(_ConfigFileHash.FileHash)" />
2323
<Warning Text="Replacing web.config due to changes during compile - This should clear warning MSB3276 on next compile" File="web.config" Condition="'$(_DllConfigHash)'!='$(_AppConfigHash)'" />
2424
<PropertyGroup>
2525
<ConfigNameSpaces>&lt;Namespace Prefix='asm' Uri='urn:schemas-microsoft-com:asm.v1' /&gt;</ConfigNameSpaces>
@@ -29,7 +29,7 @@
2929
Query="/configuration/runtime/asm:assemblyBinding/asm:dependentAssembly" Condition="'$(_DllConfigHash)'!='$(_AppConfigHash)'">
3030
<Output TaskParameter="Result" ItemName="_bindings" />
3131
</XmlPeek>
32-
<Message Text="New Bindings: %(_bindings.Indentity)" Importance="high" />
32+
<Message Text="New Bindings: %(_bindings.Indentity)" Importance="high" Condition="@(_bindings->Count())!=0" />
3333
<PropertyGroup>
3434
<Bindings>@(_bindings ,'')</Bindings>
3535
</PropertyGroup>

src/MSBuild.SDK.SystemWeb.RazorLibrary/Sdk/MSBuild.SDK.SystemWeb.RazorLibrary.DefaultPackages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<PropertyGroup>
44
<ExcludeDefaultRazorPackages Condition="'$(ExcludeDefaultRazorPackages)'==''">false</ExcludeDefaultRazorPackages>
55
<ExcludeSDKDefaultPackages Condition="'$(ExcludeSDKDefaultPackages)'==''">$(ExcludeDefaultRazorPackages)</ExcludeSDKDefaultPackages>
6+
<EnableRazorGeneratorMVC Condition="'$(EnableRazorGeneratorMVC)'==''">true</EnableRazorGeneratorMVC>
67
</PropertyGroup>
78
<PropertyGroup Condition="'$(ExcludeSDKDefaultPackages)'=='false'">
8-
<MicrosoftAspNetMvc_Version Condition="'$(MicrosoftAspNetMvc_Version)'==''">5.2.9</MicrosoftAspNetMvc_Version>
9+
<MicrosoftAspNetMvc_Version Condition="'$(MicrosoftAspNetMvc_Version)'==''">5.3.0</MicrosoftAspNetMvc_Version>
910

1011
<RazorGeneratorMSBuild_Version Condition="'$(RazorGeneratorMSBuild_Version)'==''">2.5.0</RazorGeneratorMSBuild_Version>
1112
<RazorGeneratorMVC_Version Condition="'$(RazorGeneratorMVC_Version)'==''">2.4.9</RazorGeneratorMVC_Version>
1213
</PropertyGroup>
13-
<Import Project="MSBuild.SDK.SystemWeb.Common.DefaultPackages.props"/>
1414
</Project>

0 commit comments

Comments
 (0)