diff --git a/Directory.Build.Targets b/Directory.Build.Targets index 24ebe87..a70c1ac 100644 --- a/Directory.Build.Targets +++ b/Directory.Build.Targets @@ -33,7 +33,7 @@ - + MyAssemblyName +``` +to your project file as normal. + +If you get the error `Warning MSB3276 Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. `, then you can manually copy the +```xml + + + ... + + +``` +section from the generated `.dll.config` file to your web.config file, replacing the existing `assemblyBinding` node. + +Alternatively, since the `.dll.config` file is based on your `web.config` file, you can just overwrite your `web.config` file with the `.dll.config` file. + +If you want this to happen automatically, you can add the following to your project file. +```xml + + true + +``` + +This enables the following target in the SDK which will overwrite your web.config from the patched version if there are any changes. + +```xml + + + <_DllConfig Remove="@(_DllConfig)" /> + <_AppConfig Remove="@(_AppConfig)" /> + <_ConfigFile Remove="@(_ConfigFileHash)" /> + <_DllConfig Include="$(OutDir)$(AssemblyName).dll.config" /> + <_AppConfig Include="web.config" /> + + + + + + + + + + + <_ConfigFileHash Include="@(_DllConfigFileHash)" /> + <_ConfigFileHash Include="@(_AppConfigFileHash)" /> + + + + + +``` \ No newline at end of file diff --git a/docs/Binding_Redirects/How-to-show-Suggested-Binding-Redirects.md b/docs/Binding_Redirects/How-to-show-Suggested-Binding-Redirects.md new file mode 100644 index 0000000..13c1725 --- /dev/null +++ b/docs/Binding_Redirects/How-to-show-Suggested-Binding-Redirects.md @@ -0,0 +1,56 @@ +# How to show Suggested Binding Redirects + +The following may be useful if you need to see generated binding redirects. +e.g. if you want to manually add them to your `web.config` +```xml + + + + + + + + + + + + "); + sb.AppendLine("\t"); + sb.Append("\t\t"); + sb.Append("\t\t"); + sb.AppendLine("\t"); + sb.AppendLine(""); + } + Log.LogMessage(MessageImportance.High,sb.ToString()); + ]]> + + + + + + + +``` \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..eb21c8e --- /dev/null +++ b/docs/README.md @@ -0,0 +1,89 @@ +# MSBuild.SDK.SystemWeb + +[![Build Status](https://dev.azure.com/flexviews/MSBuild.SDKs.SystemWeb/_apis/build/status/CZEMacLeod.MSBuild.SDK.SystemWeb?branchName=main)](https://dev.azure.com/flexviews/MSBuild.SDKs.SystemWeb/_build/latest?definitionId=69&branchName=main) +[![Source](https://img.shields.io/badge/github-source-lightgrey?logo=github)](https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb) + +This MSBuild SDK is designed to allow for the easy creation and use of SDK (shortform) projects targeting ASP.NET 4.x using System.Web. + +## What's available + +### [MSBuild.SDK.SystemWeb](SDK.md) + +[![NuGet package](https://img.shields.io/nuget/v/MSBuild.SDK.SystemWeb.svg)](https://nuget.org/packages/MSBuild.SDK.SystemWeb) +[![NuGet downloads](https://img.shields.io/nuget/dt/MSBuild.SDK.SystemWeb.svg)](https://nuget.org/packages/MSBuild.SDK.SystemWeb) + +This is the basic SDK that enables Visual Studio 2019 to work with an ASP.Net 4.x based project using a short form project file. + +### [MSBuild.SDK.SystemWeb.Templates](Templates.md) + +[![NuGet package](https://img.shields.io/nuget/v/MSBuild.SDK.SystemWeb.Templates.svg)](https://nuget.org/packages/MSBuild.SDK.SystemWeb) +[![NuGet downloads](https://img.shields.io/nuget/dt/MSBuild.SDK.SystemWeb.Templates.svg)](https://nuget.org/packages/MSBuild.SDK.SystemWeb) + +This is a set of templates that allow for the easy creation of projects based on the MSBuild.SDK.SystemWeb project SDK type. + +## How can I use these SDKs? + +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 to the package name: + +```xml + + ... +``` + +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: + +```json +{ + "msbuild-sdks": { + "MSBuild.SDK.SystemWeb" : "4.0.33" + } +} +``` + +Since MSBuild 15.6, SDKs are downloaded as NuGet packages automatically. Earlier versions of MSBuild 15 required SDKs to be installed. + +For more information, [read the documentation](https://docs.microsoft.com/visualstudio/msbuild/how-to-use-project-sdk). + +## What are MSBuild SDKS? +MSBuild 15.0 introduced new project XML for .NET Core that we refer to as SDK-style. These SDK-style projects looks like: + +```xml + + + net48 + + +``` + +At evaluation time, MSBuild adds implicit imports at the top and bottom of the project like this: + +```xml + + + + + net48 + + + + +``` + +# Useful Information + +## Binding Redirects +- [How to show Suggested Binding Redirects](Binding_Redirects/How-to-show-Suggested-Binding-Redirects.md) +- [Autogenerating Binding Redirects](Binding_Redirects/Autogenerating-Binding-Redirects.md) + +## Known Limitations +- ![GitHub issues by-label](https://img.shields.io/github/issues/CZEMacLeod/MSBuild.SDK.SystemWeb/known%20limitation?label=known%20limitations) +- ![GitHub issues by-label](https://img.shields.io/github/issues-closed/CZEMacLeod/MSBuild.SDK.SystemWeb/known%20limitation?label=known%20limitations) +- [Projects don't work with dotnet CLI tooling](https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb/issues/1) +- [Docker Containers](https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb/issues/9) +- [WebForms](https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb/issues/11) +- [VS Publish Command](https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb/issues/12) + +## Templates +- [How to install and use the templates](Templates.md) \ No newline at end of file diff --git a/docs/SDK.md b/docs/SDK.md new file mode 100644 index 0000000..b2c60c9 --- /dev/null +++ b/docs/SDK.md @@ -0,0 +1,30 @@ +# MSBuild.SDK.SystemWeb + +[![Build Status](https://dev.azure.com/flexviews/MSBuild.SDKs.SystemWeb/_apis/build/status/CZEMacLeod.MSBuild.SDK.SystemWeb?branchName=main)](https://dev.azure.com/flexviews/MSBuild.SDKs.SystemWeb/_build/latest?definitionId=69&branchName=main) +[![NuGet package](https://img.shields.io/nuget/v/MSBuild.SDK.SystemWeb.svg)](https://nuget.org/packages/MSBuild.SDK.SystemWeb) +[![NuGet downloads](https://img.shields.io/nuget/dt/MSBuild.SDK.SystemWeb.svg)](https://nuget.org/packages/MSBuild.SDK.SystemWeb) + +Based on the discussion and ideas in [Add support for ASP.NET (non-Core) projects](https://github.com/dotnet/project-system/issues/2670) + +## How can I use this SDKs? + +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: + +```xml + + ... +``` + +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: + +```json +{ + "msbuild-sdks": { + "MSBuild.SDK.SystemWeb" : "4.0.33" + } +} +``` + +You can also use the [templates](Templates.md) to easily create new projects. \ No newline at end of file diff --git a/docs/Templates.md b/docs/Templates.md new file mode 100644 index 0000000..fcbabeb --- /dev/null +++ b/docs/Templates.md @@ -0,0 +1,52 @@ +# MSBuild.SDK.SystemWeb.Templates + +[![Build Status](https://dev.azure.com/flexviews/MSBuild.SDKs.SystemWeb/_apis/build/status/CZEMacLeod.MSBuild.SDK.SystemWeb?branchName=main)](https://dev.azure.com/flexviews/MSBuild.SDKs.SystemWeb/_build/latest?definitionId=69&branchName=main) +[![NuGet package](https://img.shields.io/nuget/v/MSBuild.SDK.SystemWeb.Templates.svg)](https://nuget.org/packages/MSBuild.SDK.SystemWeb) +[![NuGet downloads](https://img.shields.io/nuget/dt/MSBuild.SDK.SystemWeb.Templates.svg)](https://nuget.org/packages/MSBuild.SDK.SystemWeb) + +## Installation + +```cmd +dotnet new -i MSBuild.SDK.SystemWeb.Templates +``` + +## Updating + +Optionally +```cmd +dotnet new --update-check +``` +and +```cmd +dotnet new --update-apply +``` +**N.B.** This applies to all installed templates. +```cmd +dotnet new -i MSBuild.SDK.SystemWeb.Templates +``` +Should update you to the latest version even if you have them already installed. + +## Usage + +### CLI +```cmd +dotnet new systemweb +``` +or +```cmd +dotnet new systemwebfull +``` + +To select the VB.Net version use the flag `-lang VB` +e.g. +```cmd +dotnet new systemweb -land VB +``` + +### Visual Studio 2019 +Alternatively use the Visual Studio Add Project dialog. +You need to have enabled the Preview feature to show [.NET CLI Templates in Visual Studio](https://devblogs.microsoft.com/dotnet/net-cli-templates-in-visual-studio/) and have Visual Studio 16.8 Preview 2 or higher. + +![Visual Studio New Project Dialog](https://raw.githubusercontent.com/CZEMacLeod/MSBuild.SDK.SystemWeb/main/src/MSBuild.SDK.SystemWeb.Templates/images/create-new-project.png) + +You can find the new templates easily by selecting `System.Web` from the Project Type dropdown. diff --git a/docs/docs.csproj b/docs/docs.csproj new file mode 100644 index 0000000..add9999 --- /dev/null +++ b/docs/docs.csproj @@ -0,0 +1,12 @@ + + + + netstandard2.0 + + + + + + + + diff --git a/src/MSBuild.SDK.SystemWeb.Templates/README.md b/src/MSBuild.SDK.SystemWeb.Templates/README.md index dc23f4e..6515d3f 100644 --- a/src/MSBuild.SDK.SystemWeb.Templates/README.md +++ b/src/MSBuild.SDK.SystemWeb.Templates/README.md @@ -25,3 +25,10 @@ You need to have enabled the Preview feature to show [.NET CLI Templates in Visu ![Visual Studio New Project Dialog](images/create-new-project.png) You can find the new templates easily by selecting System.Web from the Project Type dropdown. + +## Documentation + +For more information see + +[![Source](https://img.shields.io/badge/github-source-lightgrey?logo=github)](https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb) +[![Docs](https://img.shields.io/badge/github_pages-docs-lightgrey?logo=github)](https://czemacleod.github.io/MSBuild.SDK.SystemWeb/) diff --git a/src/MSBuild.SDK.SystemWeb/README.md b/src/MSBuild.SDK.SystemWeb/README.md index 10f8fd7..011e821 100644 --- a/src/MSBuild.SDK.SystemWeb/README.md +++ b/src/MSBuild.SDK.SystemWeb/README.md @@ -27,4 +27,11 @@ Or omit the version from the SDK attribute and specify it in the version in `glo } ``` -You can also use the [templates](../MSBuild.SDK.SystemWeb.Templates) to easily create new projects. \ No newline at end of file +You can also use the [templates](../MSBuild.SDK.SystemWeb.Templates) to easily create new projects. + +## Documentation + +For more information see + +[![Source](https://img.shields.io/badge/github-source-lightgrey?logo=github)](https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb) +[![Docs](https://img.shields.io/badge/github_pages-docs-lightgrey?logo=github)](https://czemacleod.github.io/MSBuild.SDK.SystemWeb/)