views:

29

answers:

2

Hi All,

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.

+1  A: 

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...

moontear
A: 

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?

Iain Ballard
I am using edmx and i need referencial integrity in Model i.e the option for Including Foreign Key constraint in Model while adding edmx to my project App
Dhaval Pandya
Ouch -- that's going to be tricky. I'd recommend exposing the relevent parts of your Entity Framework domain as a WCF service or similar. The WCF contract version of your model should be workable on both 3.5 and 4.0.
Iain Ballard
Thats doesnt seem to be feasible solution as the edmx would be used between many modules and exposing it in such a way would not be possible.
Dhaval Pandya
Sorry to hear that -- but if you need both Sharepoint and .Net 4.0, it's going to involve some major work. Would probably be a good point at which to ensure that your domain model and persistence are nicely seperated. A few dozen calls in WCF would be quite simple at both ends.
Iain Ballard