SharePoint project won't retain target framework upon creation - visual-studio

I'm having trouble creating a sharepoint project with .net 4.0.
Using Visual Studio 2010, when I attempt to create a new "Empty SharePoint Project", I select ".NET Framework 4" under the .net version dropdown list (actually it's the default selection), and then i click ok. When I look at the "Target framework" property in my package properties, it says ".NET Framework 3.5" and does not list any other versions.
I have assured that .net 4.0 is installed, and I even have another Class Library project under the same solution with version 4.0. I also tried it on a different machine, and the same thing happened. What is going on?
screenshots:
creating a new sharepoint project
newly created sharepoint project properties
other class library project in the same solution successfully using version 4

SharePoint 2010 is built to use v2.0 of the .NET CLR (which is used by .NET Framework 2, 3 and 3.5). .NET 4 uses a different CLR and thus is incompatible with SharePoint insofar as developing solutions to run inside SharePoint.
You can build .NET 4.0 applications that call SharePoint's web services, use the client object model, or even run under a virtual directory under SharePoint. But you're stuck using 3.5 for an actual solution.

Related

How do I convert a project from targeting .net core to target framework to a .net standard?

I created a new .net core 3.1 project and built it using VS2019 16.4.4
Now I want to change it to .Net Standard.
I know to go to the project properties and select the Target framework combo.
However no Standard framework options appear.
If I select Install other frameworks then I am taken to The download .Net SDKs for Visual Studio page
However the SDK I want is already installed on my machine.
Why am I not seeing what I want in the combo box.?
.NET Standard, like .NET Core and .NET Framework, is separate framework, so you can't switch that easily. You would need to create separate project targeting .NET Standard. Once you do it, you will see other options in 'Target framework'.
Worth to mention, you can't reference .NET Core and .NET Framework projects from your .NET Standard library, since .NET Standard is just an abstraction which is built differently depending on the executing environment (.NET Core or Framework)

In Visual Studio 2019, .net Core 2.1, how do I add .net Framework assembly to the project

I am working in Visual Studio 2019, and .net Core 2.1.1.
I am currently working on trying to get Identity Server 4's WsFederation integrated. In the latest instructions I could find, he mentions adding System.IdentityModel to the app through the project.json. Project.json seems to be deprecated now in .net core projects, and I am having a hell of a time figuring out how to add a freaking .net assembly to my project. Do I really need to just copy the file into the project and reference, cause that just seems wrong.
Instructions I am using:
https://www.scottbrady91.com/Identity-Server/IdentityServer-4-SharePoint-Integration-using-WS-Federation
Seems to all come back to the project type. I had created the project with AspnetCore and so I couldn't reference any .net framework assemblies, because you can't go back once you have made that choice. However, if you create the project specifically under the .net framework, you can move forward into the core frameworks, and hosting libraries of core. Which then allowed me to pull in the System.IdentityModel assemblies I needed to continue forward.

Visual Studio 2019 16.3.6 ASP.NET Core Web Application project template does allow asp.net core version selection

I've just updated Visual Studio 2019 to 16.3.6 which includes the ASP.Net Core 3 SDK.
I create a new project from the ASP.NET Core Web Application project template. The previous version would let me pick the ASP.Net Core version (2,2.1,2.2). Now it does not, and defaults to creating the project using ASP.Net Core 2.2, not 3. Do I always need to manual upgrade every project I create or is there somewhat to bring back the version dropdown or set visual studio to default to Core 3?
I've got Core 3.0 SDK installed:
Then I choose ASP.NET Core Web Application
There are no other core related web projects to chose. Click Next
Then I configure the project There are no options for version, or authentication. I used to see those options prior to the upgrade.
The option is still there. I think you need to install .Net core 3 SDK.

Web Developer 2010 Express does not list 4.0 framework

Whatever I do for several days now, Web Developer 2010 Express does not see 4.0 NET Framework. If to right click on solution properties in the Application – Target Framework it lists 2.0, 3.0 and 3.5, which are NOT installed on my computer but 4.0 which is actually installed. I tried to clean all using dotnetfx_cleanup_tool, reinstalled 4.0 client and full several times, copied reference assemblies to different folders and so on but WDE still does not see it.
I also have SDK for Windows 7 and .NET Framework 4 installed.
Where and how does it find frameworks, does in scan registry or some config file?
To target .NET 2.0/3.0/3.5, you have to install .NET 3.5.
And Web Develoepr requires full profile, not client profile.

Why is the Target Framework dropdown empty and greyed out in my C# class library, VS2008

Fairly self-explanatory. I have recently installed .NET framework 4 and VS2010 but I want to compile my 3.5 projects using 3.5 as 4 has not yet been installed on our production servers and I get "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." if I try
All project types have the target framework dropdown greyed out
Make sure that your registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\OnlyUseLatestCLR
and
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\OnlyUseLatestCLR
are set to 0 (not 1).
This fixed it for me since applications like VS2008 are no longer forced to use .NET 4.0 runtime. I had previously set these registry keys to allow Powershell run inder .NET 4.0, however, a config file should be used for that instead.
This has something to do with .NET 2.0 assemblies (i.e. mscorlib) being removed from GAC.
I managed to fix this by first uninstalling .NET framework 3.5 and 4.0 from my Windows 7 using .NET framework cleanup tool:
http://blogs.msdn.com/b/astebner/archive/2008/08/28/8904493.aspx
And then reinstalling both frameworks (first 3.5, then 4.0) from the web. Now the drop-down has options again in VS2008 and I can multi-target 3.5 framework from VS2010.

Resources