how .net 1.1 application can work with .net 2.0 assembly - .net-1.1

We have old .net 1.1 project that is using a third party component. Aparently that component is not working properly with new requirements, and there is no support from the provider. Provider proposed to use new component that is working properly. The problem is that this component requires .net 2.0.
The project is big and it will be costly to move this project to 2.0.
What other alternatives we can have? How 1.1 assembly can call 2.0 assembly?

.NET 1.1 can't load .NET 2.0 assemblies, because the internal format changed. Your app will basically think that the assembly isn't a .NET assembly.
Long term, it would be a good idea to update your application to use .NET 2.0 (if not something newer, since there are multiple versions of .NET since 2.0 now). However, if that is not an option, you could create a .config file for your executable, and tell the CLR to always use .NET 2.0 when running your app. This should allow for the .NET 2.0 assembly to load, however any breaking changes between .NET 1.1 and 2.0 that your app makes use of will cause errors.

Related

How to fix problem with Entity Framework Core v3.1.31 looking for Microsoft.Bcl.HashCode 1.0.0.0

We're in the process of converting old .NET 4.7.2 code to .NET 7. In the migration we're creating some .NET Standard 2.0.3 projects and moving the data layer code into one so it can be used by both .NET versions. But to do this we need to use an older version of .NET Standard (2.0.3) and Entity Framework Core v3.1.31.
For all of the other developers on our team this works fine. However for myself, when I run the code I get an exception thrown from the data layer .NET Standard project that it couldn't load Microsoft.Bcl.HashCode 1.0.0.0. The weird thing is that the Entity Framework Core version we're using is referencing Microsoft.Bcl.HashCode 1.1.1
I can't find any reference to the 1.0.0.0 version of Microsoft.Bcl.HashCode. Any idea what might be going on?

How to use EF Core 6.0 with an application that uses .Net Framework?

I have a situation where an application uses various component libraries. The libraries were based on .NetStandard2.0/2.1 and internally used EF Core 3.1. For various deployment and development reasons, we now want to target EF Core 6.0, which raises the following issues.
Net Core 3.1 support runs out in December 2022 so we need to move away from it.
The application uses Net Framework functionality and cannot move to Net Core.
EF Core 6.0 does not support NetStandard, only Net 6.
Changing the library that uses EF Core to target NET 6 means that components referencing it also need to reference Net 6.
Dependencies trickle down to the application that targets Net Framework and, as a result, the application no longer builds because Net Framework is not compatible Net 6.
How can the Net Framework application use the Net 6 assembly? Or, more specifically, how can a Net Framework application use libraries that internally use EF Core 6.0?
The interface between the application (Net Framework) and the one single touch point library component (Netstandard) is very well defined. Maybe Pinvoke could solve the problem? Or something simpler that I have overlooked?
Somewhat related question: NU1202 Package Microsoft.EntityFrameworkCore 6.0.3 is not compatible with netstandard2.1
Other than process to process communication between .NET Framework and .NET 6, this is not supported (for example via a Web API or similar)
As a short term solution, you can change your .Net Standard 2.0 EF Core libraries to be multi targeted to both .Net Standard 2.0 (which will reference EF Core 3.1) and .Net 6 (which will reference EF Core 6). This will let your .Net Core apps use EF Core 6, while allowing your .Net Framework apps to use the same dlls, but to be using EF Core 3.1. I realize that EF Core 3.1 support ends December 2022, but it will keep things moving.
https://learn.microsoft.com/en-us/nuget/create-packages/multiple-target-frameworks-project-file
Btw, has Microsoft even attempted to address the fact that a .Net Framework application cannot reference .Net 6, therefore it cannot use EF Core 6? This is a major issue for us, as we were sold the idea that .Net Standard could be shared between .Net Framework and .Net Core, but this has ceased to be the case since .Net Standard 2.1 was introduced, and now MS has pushed all new features, like EF Core, to .Net 6.

How to get a .NET core 3.1 Project work with .NET 5.0 project

When .NET 5.0 was released, one of the features mentioned was the ability to create a .NET 5.0 component, that it would work with .NET 3.1, so you wouldn't have to use .net standard between different versions.
Well, I tried to use .net 3.1 with .net 5.0 and I keep getting errors. Is there something special we have to do to make these work? We have multiple applications at my company that use various versions of .NET core. from 2.2, 3.0, 3.1 to .net 5.0. We would like to create some NuGet packages for some of the reusable components, but trying to figure out how to use .net core through out these applications, I don't want to create them with .net standard.
Has anyone run into this or not?
You did not provide the errors, but despite that, it can already be said that .NET 5 does not ensure backwards compatibility. Microsoft provides information on compatibility and breaking changes here.
.NET 5 merges together .NET Framework and .NET Core, ending the burden of keeping both; the aim is to also include Mono and Xamarin (MAUI). However, it does not ensure compatibility with previous versions. This is a good article on the subject - some features were delayed to .NET 6 though.
Hence, the best ways for you to have the compatibility you want would be to use .NET Standard or, even better, migrate the applications to .NET 5, since previous versions' support will end soon. In the team I work, we made some migrations from .NET Core 3.x to .NET 5 and it was pretty straightforward.
It is worth noticing that .NET 5 is not LTS. .NET 6, on the other hand, is. More details on .NET releases and support policies here.
A .net 5.0 library/dll cannot be referenced from a .net version less than .net 5.0. .net standard 2.1 should be used for compatibility between the different versions of .net core and .net 5.0.
On another note - its probably best to update all .net core projects to 5.0 assuming this is possible. The End of Life has been reached on .net core versions <= 3.0 (not .net standard).
see here.

Where is the "System.Composition.TypedParts.dll"?

I am trying to use the ContainerConfiguration type from the Managed Extensibility Framework (MEF). According to here, it lives in "System.Composition.TypedParts.dll" which is part of .NET Framework 4.5. But I cannot find it in Add Reference for a .NET 4.5 application.
Where can I find this DLL?
It turned out to be part of MEF 2, which needs to be installed with NuGet. It's not distributed with .NET Framework.

Sharepoint 2010 Foundation with .Net Framework 4.0

I am having a Web Application with build target as .Net Framework 4.0.
I want to interact with the Sharepoint Object Model API's but it gives a framework 4.0 runtime does not supports Sharepoint.dll error.
Is their any tweak such that I can use Sharepoint 2010 with .Net Framework4.0.
Note: I cannnot change the build target of the web app to any other framework as I am using some exclusive features of .net 4.0 in my application.
Sorry you probably will have no luck:
There appears to be some confusion
around whether or not ASP.NET 4 is
supported for both MOSS and SharePoint
2010 - in short, the answer is that it
is not currently supported in either
product.
Whilst it is possible to use ASP.NET
3.5 in MOSS by making some modifications to the SharePoint site
web.config (instructions for doing
that in MOSS here; SP2010 uses 3.5 by
default), this is unfortunately not
the case with version 4.
The reason? ASP.NET 4 uses a new
version of the Common Language Runtime
(CLR). Whilst .NET 2.0, 3.0 and 3.5
all used version 2.0 of the CLR, .NET
4 uses version 4. I'm not entirely
sure what happened to version 3. There
is a decent post on stack overflow
with further details.
from SharePoint 2010 and .NET 4: confused?
Maybe .NET 4.0 Support will be added in a future update (SP1?) who knows...
Unfortunately, .Net 2.0 to 3.5 use a different application pool type from .Net 4.0; Mixing in the same app pool is not going to work.
What features of .Net 4.0 are you using, and perhaps the community can help you with a 3.5 solution?