EstrellasDeEsperanza.WebFormsForCore.Build 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package EstrellasDeEsperanza.WebFormsForCore.Build --version 1.2.0                
NuGet\Install-Package EstrellasDeEsperanza.WebFormsForCore.Build -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EstrellasDeEsperanza.WebFormsForCore.Build" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EstrellasDeEsperanza.WebFormsForCore.Build --version 1.2.0                
#r "nuget: EstrellasDeEsperanza.WebFormsForCore.Build, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EstrellasDeEsperanza.WebFormsForCore.Build as a Cake Addin
#addin nuget:?package=EstrellasDeEsperanza.WebFormsForCore.Build&version=1.2.0

// Install EstrellasDeEsperanza.WebFormsForCore.Build as a Cake Tool
#tool nuget:?package=EstrellasDeEsperanza.WebFormsForCore.Build&version=1.2.0                

WebFormsForCore

A library to run WebForms apps on ASP.NET Core. This library provides a port of the System.Web libraries of .NET Framework to .NET 8. With this library, you can run WebForms websites directly in ASP.NET Core, also on Linux, altough Linux support is not yet stable.

Support

If you need support porting your project to NET Core & WebFormsForCore, we provide support for 20$ per hour. Please contact us via Messenger. There is also a tutorial on Youtube on how to convert a sample WebForms application to WebFormsForCore.

Usage

If you have a WebForms project you want to convert to NET Core, proceed as follows:

First convert your Project to a SDK Project. For the moment, please also keep the old non SDK style project, as WebFormsForCore does not yet properly support generation of the Designer.cs files from aspx. Conversion can be done easiest by using a converter like the migrate-2019 tool. To install that tool, run dotnet tool install --global Project2015To2017.Migrate2019.Tool. Then go to the directory of your solution and run dotnet migrate-2019 wizard to convert your solution to an SDK project. If the converter complains about an unsupported project type, remove the <ProjectTypeGuid> property from the project first. After conversion change the target framework of your project to net8.0. You might also keep net48, in order to dual run your project with NET Framework & NET Core. Change the OutputPath for net8.0 to bin_dotnet:

<PropertyGroup>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
    
    <BaseIntermediateOutputPath>obj\$(Configuration)\$(TargetFramework)\</BaseIntermediateOutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' != 'net48'">
    <OutputType>Exe</OutputType>
    <OutputPath>bin_dotnet</OutputPath>
    <StartupObject>Program</StartupObject>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net48'">
    <OutputType>Library</OutputType>
    <OutputPath>bin</OutputPath>
</PropertyGroup>

Then, for net8.0, import the WebFormsForCore packages like so:

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
    <PackageReference Include="EstrellasDeEsperanza.WebFormsForCore.Web" Version="1.0.0" />
</ItemGroup>

Remove the old Reference references or put them in a condition only for net48.

If your project also needs System.Web.Extensions or System.Web.Optimization import the corresponding packages also, like EstrellasDeEsperanza.WebFormsForCore.Web.Extensions or EstrellasDeEsperanza.WebFormsForCore.Web.Optimization etc. The following packages are available:

  • System.Configuration: EstrellasDeEsperanza.WebFormsForCore.Configuration
  • System.Web: EstrellasDeEsperanza.WebFormsForCore.Web
  • System.Web.Services: EstrellasDeEsperanza.WebFormsForCore.Web.Services
  • System.Web.Extensions: EstrellasDeEsperanza.WebFormsForCore.Web.Extensions
  • System.Web.Optimization: EstrellasDeEsperanza.WebFormsForCore.Web.Optimization
  • System.Web.Mobile: EstrellasDeEsperanza.Web.Mobile
  • Microsoft.AspNet.Web.Optimization.WebForms: EstrellasDeEsperanza.WebFormsForCore.Web.Optimization.WebForms
  • WebGrease: EstrellasDeEsperanza.WebFormsForCore.WebGrease
  • System.Drawing: EstrellasDeEsperanza.WebFormsForCore.Drawing
  • AjaxControlToolkit: EstrellasDeEsperanza.WebFormsForCore.AjaxControlToolkit
  • AjaxControlToolkit.HtmlEditor.Sanitizer: EstrellasDeEsperanza.WebFormsForCore.AjaxControlToolkit.HtmlEditor.Sanitizer
  • AjaxControlToolkit.StaticResources: EstrellasDeEsperanza.WebFormsForCore.AjaxControlToolkit.StaticResources

System.Drawing only implements Attributes, so WebFormsForCore can run on Linux, where System.Drawing.Common.dll is missing.

Finally configure ASP-NET Core to use WebForms in the initialization code Program.cs like so:

#if NETCOREAPP

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

public class Program
{

	public static void Main(string[] args)
	{
		var builder = WebApplication.CreateBuilder(args);

		// Add services to the container.
		builder.Services.AddRazorPages();
		builder.Services.AddControllersWithViews();

		var app = builder.Build();

		app.UseStaticFiles();

		//app.UseAuthorization();

		app.UseWebForms();

		//app.MapDefaultControllerRoute();
			
		app.Run();

	}
}
#endif

Conflicts with Existing Packages

Currently there might be some conflicts with the packages System.Web.dll & System.Configuration.ConfigurationManager.dll, since WebFormsForCore replaces those dll's. In order to prevent import of the old dll's include the following in your csproj:

<Target Name="ChangeAliasesOfNugetRefs" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
    <ItemGroup>
        
        <ReferencePath Remove="%(Identity)" Condition="'%(FileName)' == 'System.Configuration.ConfigurationManager' AND $([System.Text.RegularExpressions.Regex]::IsMatch(%(Identity),'\\8\.0\..\\'))" />
        
        <ReferencePath Remove="%(Identity)" Condition="'%(FileName)' == 'System.Web' AND $([System.Text.RegularExpressions.Regex]::IsMatch(%(Identity),'\\dotnet\\'))" />
    </ItemGroup>
</Target>
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.2 0 11/24/2024
1.2.1 61 11/21/2024
1.2.0 103 11/20/2024
1.1.3 70 11/15/2024
1.1.1-beta 68 11/9/2024
1.0.0 107 8/5/2024