Based on the discussion and ideas in Add support for ASP.NET (non-Core) projects
When using an MSBuild Project SDK obtained via NuGet (such as the SDKs in this repo) a specific version must be specified.
Either append the version (as shown in the nuget shield above) to the package name:
<Project Sdk="MSBuild.SDK.SystemWeb/4.0.88">
...
Or omit the version from the SDK attribute and specify it in the version in global.json
, which can be useful to synchronise versions across multiple projects in a solution:
{
"msbuild-sdks": {
"MSBuild.SDK.SystemWeb" : "4.0.88"
}
}
You can also use the templates to easily create new projects.
Property | Default value | Description |
---|---|---|
ExcludeSDKDefaultPackages |
false | Do not include the default packages Microsoft.Net.Compilers.Toolset and Microsoft.CodeDom.Providers.DotNetCompilerPlatform |
ApplySDKDefaultPackageVersions |
true* | Apply default version numbers to packages unless using a Central Package Management system |
GeneratedBindingRedirectsAction |
None | Set the desired default behavior of what to do with SuggestedBindingRedirects if not yet set. See automatically generated binding redirects <ul><li> None - Do nothing except show the warning</li><li>Preview - Creates new Web.BindingRedirects.config file showing proposed changes</li><li>Overwrite - Updates the $(AppConfig) aka web.config in the project root</li></ul> |
*Version numbers are not applied if you are using Microsoft.Build.CentralPackageVersions
version 2.1.1 or higher. Remember to include the packages in your central package versions file.
Property | Default value | Description |
---|---|---|
MvcBuildViews |
true if Configuration is Release false otherwise |
Whether to invoke the AspNetCompiler automatically after build |
EnableWebFormsDefaultItems |
Same as EnableDefaultItems |
Whether to automatically include WebForms files as content <ul><li> *.asax</li><li> *.ascx</li><li> *.ashx</li><li> *.asmx</li><li> *.aspx</li><li> *.master</li><li> *.svc</li></ul> |
SetRoslynToolPath |
true if RoslynToolPath is empty |
Sets RoslynToolPath to the version included in Microsoft.Net.Compilers.Toolset to allow compiling .aspx files etc. using a newer langversion** |
** You will have to adjust your web.config to change the system.codedom/compilers/compiler
compilerOptions
attribute to set the langversion - it won’t automatically use the LangVersion
property from your project file.
| Property | Default value | Description |
| ——– | ————- | ———– |
| ExcludeASPNetCompilers
| false | Use ExcludeSDKDefaultPackages
instead |
| OverwriteAppConfigWithBindingRedirects
| false | If set, will set GeneratedBindingRedirectsAction
to Overwrite
then any will be copied into your web.config file. |
Package | Default Version | Property |
---|---|---|
Microsoft.Net.Compilers.Toolset |
4.5.0 | MicrosoftNetCompilersToolset_Version |
Microsoft.CodeDom.Providers.DotNetCompilerPlatform |
3.6.0 | MicrosoftCodeDomProvidersDotNetCompilerPlatform_Version |