ASP.NET site with Mixed mode Assemblies (NET 2.0, NET 4.0, NET Core) in Web Application Projects (WAP)

0

Many years main stream of ASP.NET was Web Site Projects (WSP), so named ProjectLess architecture. But new revolution idea from Microsoft is Web Application Projects (WAP), i.e. each ASP.NET site must have project file and ASP.NET site must be compile to one monolithic assembly. Maybe for new development this is not a bad idea, but how is possible to realize this idea in real world? For example my site in ProjectLess architecture compiled to some assemblies referenced to different framework. This is dump from IlSpy of my site created with ProjectLess architecture.

' E:\Projects\Arenda_5\www\bin\App_Code.dll ' App_Code, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 4.0

' E:\Projects\Arenda_5\www\bin\AjaxControlToolkit.dll ' AjaxControlToolkit, Version=3.5.7.123, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 2.0

' E:\Projects\Arenda_5\www\bin\App_global.asax.dll ' App_global.asax, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 4.0

' E:\Projects\Arenda_5\www\bin\App_GlobalResources.dll ' App_GlobalResources, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 4.0

' E:\Projects\Arenda_5\www\bin\App_Web_4xh2h4z1.dll ' App_Web_4xh2h4z1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 4.0

' E:\Projects\Arenda_5\www\bin\App_Web_cc1zern3.dll ' App_Web_cc1zern3, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 4.0

.....

' E:\Projects\Arenda_5\www\bin\App_Web_yxcevpfj.dll ' App_Web_yxcevpfj, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 4.0

' E:\Projects\Arenda_5\www\bin\App_WebReferences.dll ' App_WebReferences, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 4.0

' E:\Projects\Arenda_5\www\bin\AspCommon2009.dll ' AspCommon2009, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 2.0

As a result my site referenced to assemblies from different framework:

' E:\Projects\Arenda_5\www\bin\Newtonsoft.Json.dll ' Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 2.0

' C:\WINDOWS\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll ' System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 2.0

' C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll ' mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ' Global type: ' Architecture: x86 ' Runtime: .NET 2.0

' C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll ' mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ' Global type: ' Architecture: x86 ' Runtime: .NET 4.0

' C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll ' System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ' Global type: ' Architecture: x86 ' Runtime: .NET 2.0

' C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll ' System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 2.0

' C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll ' System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' This assembly contains unmanaged code. ' Runtime: .NET 2.0

' C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualBasic\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll ' Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 2.0

' C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualBasic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll ' Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 4.0

' C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll ' System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 2.0

' C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll ' System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 2.0

' C:\WINDOWS\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll ' System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ' Global type: ' Architecture: AnyCPU (64-bit preferred) ' Runtime: .NET 2.0

And many other Assemblies from different framework.

As a result any my attempt to rebuild this site with project file (with Web Application Projects - WAP) and one monolithic assemblies has crashed with this message

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) - Visual Studio 2017

Anybody understanding how is possible to fix this issue, how is possible to create one ASP.NET assembly in WAP project type where result assembly has referenced to many different NET frameworks?

asp.net
.net
msbuild
assemblies
.net-framework-version
asked on Stack Overflow Mar 15, 2020 by Viacheslav

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0