Sharepoint 2010 Foundation with .Net Framework 4.0 - asp.net-mvc-2

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?

Related

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.

Can Entity Framework 6 be used in a .NET Standard project?

And if not, will it be? If so, when?
I haven't been able to find any clear official information on this, and the limited information I was able to find on Stack Overflow is a year or two old.
I was able to find official information saying EF 6.3 will be able to be used in a .NET Core project, but I couldn't find a release date for it, nor am I sure what the implications for use in a .NET Standard project are.
EF 6 supports .NET Standard 2.1, which is currently supported by .NET Core 3.0 or later - no .NET Framework version. EF 6 also supports .NET 4.0 and 4.5 or later.
https://github.com/aspnet/EntityFramework6/blob/release/6.4/src/EntityFramework/EntityFramework.csproj#L6
Some clarification, since EntityFramework 6.3.0 .NET Standard 2.1 has been supported. However there is no .NET Framework version that supports .NET Standard 2.1. Comment from Microsoft:
NET Framework won't support .NET Standard 2.1 or later versions. For
more details, see the announcement of .NET Standard 2.1.
This means that a majority of all applications using EntityFramework 6.X won't be able to use the .NET Standard 2.1 project anyway.
https://learn.microsoft.com/en-us/dotnet/standard/net-standard
https://www.nuget.org/packages/EntityFramework/#

Will .Net framework 4.8 support Microsoft enterprise library v6.0?

Since some of our applications are written in .Net framework 2.0 & 4.5, We've plan to migrate our applications to .Net framework 4.8 and we have used MS enterprise library v3.0 & v5.0 and would like to uplift to enterprise library v6.0 Before going to migrate, need to know will the latest .Net framework 4.8 support enterprise library v6.0.
There is a port of Enterprise Library 6.0 that is supports .Net Core and .Net Standard 2.0.
I have not used that yet, so I cannot tell anything about its quality but based on the Nuget stats it seems tell that people are using these packages.
Also the original Microsoft Enterprise Library source code was published on GitHub so you could recompile the whole project using updated references, not sure how much effort would that cost.

Can I use EF4 in VS 2012?

I wanted to follow up on a post from last year ("EF5 , Widows Forms , Dragging a chield entity from project datasource into a GridView creates only 2 columns").
I believe the problem described with EF5 is still true and the solution found (use EF4) continues to be the only reasonable answer.
Before I upgrade to VS2012, I wanted to check whether anyone knows if there is any problem using EF4 in VS 2012.
Anyone with experience on this?
VS2012 requires .NET Framework 4.5 which is an in-place update. This means that once you install the .NET Framework 4.5 it will be always used when running .NET Framework 4 or .NET Framework 4.5 apps. This also means that you will be running EF5 even if you target .NET Framework 4 in VS (targeting is only a design time thing which prevents from using APIs that were not available in the targeted .NET Framework version while at runtime the app will use the version installed on the box).
With regards to the problem you are reporting - take a look at this bug report on the EF codeplex site as it apparently contains a solution to the problem

Convert MVC2 .NET 4 application to run on .NET 3.5

This might seem like an odd request, but is there any simple way to downgrade my ASP.NET MVC2 application running on .NET 4 (developed in VS2010) to run on .NET 3.5? I'm asking because the server I will be using to host the application on is within my university and only has.NET 3.5 installed.
Many thanks
The ASP.NET MVC 2 is built against .Net 3.5 so there is no downgrade needed there. The only problem you might have is your own code - if you are using some .Net 4.0 specific stuff you will have to change it. For starters change your projects target framework (in project properties) to 3.5 and check if it still builds.