SQL Server 2012 and .NET Framework 4.0 - asp.net

I have a server which configured for SQL Server 2008 R2 and ASP.NET 4.0.
The hosting company won't support .Net Framework 4.5 and SQL Server 2012 and latest Entity Framework.
I have created my website with .Net Framework 4.5 and latest Entity Framework 5. How can I change the publish settings to old server execute that ?

Change the Target Framework of the Website, In Solution Explorer right click the Website select 'Properties'. In the dialog that appears select Application now change the Target Framework to 4.0 and Publish.

You need to change the Target Framework for your website.In Visual Studio (with your website project selected) go to Project > Settings. Change Target Framework from .Net Framework 4.5 to .Net 4. Then rebuild all and test your app.
If it's all working OK you can then publish to your web host as normal.

The above 2 answers are correct. Additionally, many hosting companies do not support the MVC or EF dll's of any version. There is any easy work around to this. As long as you can get your code to compile in Visual Studio 2010 using .NEt 4.0, right click on your project and click 'Add Deployable Deployable Dependencies'. Check the boxes for the dll's groups you will need and they will be added to your project so they can be deployed with your website.

When installing EF5 from Nuget it will install EntityFramework.dll assembly version 5.0.0.0. if your app is targeting .NET Framework 4.5 or EntityFramework.dll assembly version 4.4.0.0 if your app is targeting .NET Framework 4. The difference between these is that EF5 for .NET Framework 4 is scoped down to what is supported by the core assembly (System.Data.Entity.dll) that is a part of .NET Framework (most notably on .NET Framework 4 you will get no enums, spatial types etc.). If you change the target after installing EntityFramework then you most likely need to uninstall what you have and install again to get the right version of the EntityFramework.dll.

you just create a new project in framework 4 and add existing items from the right click in solution in project

Related

Asp.Net Core 2.1 with .Net Framework 4.6.1 error after deployment using dotnet publish or visual studio publish

I am trying to deploy Asp.Net Core 2.1 application with target framework 4.6.1 on server. I am using dotnet publish command and copying the publish folder on the server where deployment is intended. Everything works fine on local machine. But when I am trying to run the application on the server , it is throwing the exception ".Net Framework 4.6.1 not installed, please install it.".
I thought .Net framework is not installed but when I checked installed software , I can see .Net 4.6.1 is installed. Not sure why the error is occurring.
Here is screenshot for the application error and installed software
That error is odd, since you do indeed seem to have that version installed. However, I believe it may be a red herring. I haven't personally tried to run ASP.NET Core 2.1 on .NET Framework, but I suspect it may not work at the moment. The full framework support depends on .NET Standard compatibility which only goes up to .NET Core 2.0. (With .NET Standard 2.0). ASP.NET Core requires .NET Core 2.1. You can try targeting a later version of .NET Framework - something recent like 4.7.2. You may need to downgrade to ASP.NET Core 2.0, if you need to target .NET Framework.
Your list only shows development packages to support targeting and developing for .NET Framework 4.6.1
See How to: Determine which .NET Framework versions are installed for ways to check the .NET Framework version on the machine.

IIS7 Application Pool 4.5 framework

I built a web app using dotNet 4.5. I went into IIS and created a new app pool but there was not 4.5 option, only 4.0 and 2.0. I went to install 4.5 and it says "already installed". I do a google search and see infact the registry and explorer show it to be installed.
What gives?
Although the .NET Framework Version column shows "v2.0" and "v4.0" for .NET Framework versions, these equate to ASP.NET 3.5 and ASP.NET 4.5.
Due to the internals of how application pools bind to .NET Framework versions, the actual version name written to configuration (and thus displayed in the tool) corresponds to the original .NET Framework file version.
Your question is tagged as IIS7 but the link information regarding .net versions is applicable.
Soruce: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45

How do I create a ASP.NET project based on the .NET Core, not on the full Framework?

I was reading all about .NET Core after hearing about it for months. I got Visual Studio 2015, so I thought I would try it out. I go into File - New Project, choose ASP.NET Web Application, and see I can only choose a version of the full .NET Framework (such as 4.6). How do I create a ASP.NET project based on the .NET Core, not on the full Framework?
I thought there would be some tutorials on this, but I can't find any. All I see is based on the full Framework.
ASP.NET 5.0 Core beta5 shipped with VS 2015 RTM. Beta6 just shipped and be used to upgrade VS 2015. (Read the Install Instructions!)
When you create a project from one of the ASP.NET 5 Preview Templates (Empty, Web API, or Web Application) it is set up to compile both Core and 4.5.1 Framework versions every time you build.
To change this to build only Core, do the following:
Project / Properties / Application: change Platform from .NET
Framework to .NET Core
Open project.json and find the "frameworks" section. Delete
"dnx451": {}, and save.
Build
You are now running on the CoreCLR.
You can find the .net core and nightly builds at:
https://github.com/dotnet/core
https://github.com/dotnet/coreclr
Thanks for the comments and whatnot guys... Can't delete my answer since it's accepted, so here's some screenshots showing how to get to the new template. Note that the new framework version is not listed where you (at least I) would expect. You can choose the asp.net 5 tempate after you actually choose to create a web application in one of the (non 5.0) framework templates.

How to migrate websites from .NET 2 to .NET 4 using Visual Studio?

Hi I would like to know the correct steps and procedure required to convert existing .NET 2 websites to .NET4 using Visual Studio. Please let me know if there is any online resources (blog,tutorial,video,official doc) available that teaching you. Cheers. :)
If you use Visual Studio to open a Web project that was developed for the .NET Framework 2.0, the .NET Framework 3.0, or the .NET Framework 3.5, Visual Studio can automatically perform all the changes to Web.config files that are required to be able to run using .NET Framework version 4.
If the project is a local IIS project and you are using IIS 7.0, Visual Studio can also reassign the application to an application pool that is associated with the .NET Framework version 4.
For step by step instructions, see link http://msdn.microsoft.com/en-us/library/vstudio/dd483478(v=vs.100).aspx

Convert a web app created in VS 2010 ASP.NET 4.0 to ASP.NET 3.5

I've made a web app in VS 2010 and by default, I think it uses the .NET Framework 4.0. Problem is, the server that's going to run it doesn't have 4.0.
Is there a way to downgrade the project? I'm not really knowledgeable with web hosting or web servers so I don't really know which is easier, downgrading the project or upgrading the web server. It's a company web server by the way, so I'm not sure about the legalities and stuff. It's free though, right?
Just right-click on the project in the Solution Explorer and go to properties. Under the "Application" tab, change the "Target Framework" from 4.0 to 3.5. That should do it provided you are not using any code features unique to 4.0.
If you can update the server easily, I would recommend that so that you have the 4.0 framework available to you going forward. The .NET framework is a free download.
Right-click on the project name and select Properties On the Application tab, you should see a Target framework: dropdown.

Resources