Upgrade ASP MVC project from VS2008 to 2010 - is it possible not to upgrade to .net4 at the same time - asp.net

I have a Vs2008 project using version2 of the ASP MVC framework. I tried to upgrade to VS2010. I fetched a new copy from svn and opened it. I got the expected conversion dialog, clicked next and then finish. A while later comes up a question do I want to also upgrade to the version 4 of .net framework.
I've done this same process twice wioth the same project. THe first time I clicked no and the second time I clicked yes. But, if i run a diff across the directories created, there's essentially no difference (some generated dlls differ and there's a path difference in the vbproj file but that's it). If, however, i diff the new and old project I get a whole load of differences. That's of course expected, but some of them seem to indicate that it's done the upgrade to .net4 anyway! For example, the vbproj file now referneces 4 instead of 3.5 as it's tools version and all the reference.vb files generated from the .wsdl files for my web references now have "Runtime Version:4.0.30319.1" instead of "Version:2.0.50727.4927" and Resources.Designer has a similar.
So, my question, should there be a difference between the version where I said "yes, upgrade the -net framework to version 4 for this project" and the version where I said no or does ASP run with the old version anyway? I really don't want to find that my new version doesn't work when deployed to production servers which may not have .net 4 installed!

You can always change it back to 3.5 in the project settings, so long as you don't upgrade the MVC version to MVC3. Some of those settings may say 4.0 because they depend on the VS2010 designer, which is based on 4.0, and thus needs to reference 4.0 versions at design-time.

Related

Is it possible to change from .NET Framework 4.8 to 4.7.2

Is it possible to change from .NET Framework 4.8 to 4.7.2? In my "Turn Windows features on or off", I have ASP.NET 4.8 listed. I wish to change this to 4.7.2 I tried downloading and installing the developer pack from here (https://dotnet.microsoft.com/download/dotnet-framework/net472), but no luck on changing it inside "Windows features on or off".
I don't see any real particular issue by going back on the projects .net version.
The only requirement is that you have the correct version of .net installed on your computer. I suppose you "can" go into windows settings - and if the .net framework is not selected, then fine.
I would NOT suggest that you bother to disable say some given .net framework in the windows settings.
if you need a particular .net framework - then make sure it is installed on your development computer. once done, then in project settings you can select the framework - say like this:
So no, don't disable any .net framework. Sure, you can enable as such, but I would not mess or bother to remove existing frameworks.
About the ONLY real issues are:
If any library or referenced assemblies are LATER then the framework you select, then you can't use such tools, and external libraries.
And of course the target computer then has to have AT LEAST that level of .net installed.
In fact, in some cases, especially some web hosting providers - they are often VERY MUCH behind on what versions of .net are avaible.
And then of course often your have a 4-5 year old production server. They often don't allow updates to such servers to later versions of .net, so you are in your case - can you roll back, or choose a lower .net framework.
I certainly suggest that you adjust, pick, and get your development cycle working on the lowest min target framework. That way you not only avoid (even by accident) using some libraries and tools that can't run on that target web server.
Another FYI? If you select/change that framework in the VS project settings (as per above screen shot), I suggest that after doing so, you exit VS, and re-enter. I experienced some issues when not doing this exit of VS when downgrading the project.
You then want to do a clean project, and then do a re-build all. If that re-build all don't spit out any errors, then you are in rather good shape and should be ok.
Open the Project in Visual Studio >>> Go to Project Tab on Top >>> Select Project Properties >>> Change the Target Frameworkenter image description here from the Dropdown >>> Click Yes to Save the Same

How do I set the app.config for a web based .NET app?

Unfortunately the organization I work for has a legacy .net application made in XP era, we are in the process of updating but that may not take place until a few months or even the end of the year. This .net app is web based and requires .net framework 3.5, it also needs IE9 or less to run, anything beyond this and the app will break and stop working. Somehow the update for framework 4.5.2 installed, I uninstalled it but for some reason it keep reinstalling by itself over night. I uninstall the update and the next morning I will come into work and it will reinstall. I was reading that the app.config could be set for .net apps to set the parameters of what framework they use. I am not sure where the app.config file would be located for this app or how I could find it for a web based .net app?
For an app named Something.exe, the App.config file (if you need one) should be placed in the same folder and named Something.exe.config.

.Net 1.1 upgrade to .Net 2 - Does it still use the .Net 1.1 framework

We have recently taken on support of a web application that was written many years ago and targeted v1.1 of the .net framework. It runs on Windows Server 2003/IIS 6 environment.
After looking at the configuration of the site in IIS the target framework is set to 2.0.
Given that extended support for .net 1.1 will cease in October of this year (http://support.microsoft.com/lifecycle/?p1=1249) I am trying to ascertain whether the site will still use any of the .net 1.1 framework assemblies given that the application is built and compiled in Visual Studio 2003.
I am assuming this is the case because although ASP.net 2 is set as the target framework
in IIS (and therefore the aspet_isapi.dll invoked is the .net 2 one etc) the assembly is a .net 1.1 assembly and will therefore still use the 1.1 framework. However, is this assumption actually true?
The website only has another year or so to live before being replaced by a new solution entirely so I would prefer not to upgrade it if possible and run the risks such changes bring with them.
However, we obviously can't run something on an unsupported version of the framework if any element of if that framework is actually being used.
Any thoughts would be appreciated.
Update:
It would seem that .net 1.1 is a core component of WS2k3 so you can't just uninstall it. I could have attempted to remove the ASP.net component but I don't think that would fully uninstall everything and given that the dev environment is shared I can't risk causing any issues right now.
However I have previously set everything up on my local machine (Windows 7/IIS 7), so I changed the application pool to point at .net 2 (it was already running in classic pipeline mode), uninstalled .net frameworks 1 and 1.1 and cleaned up the files left behind afterwards.
The result was that the site ran absolutely fine, which would suggest in an IIS 7 environment at least that I don't need to worry about upgrading given we are running under .net 2 within IIS.
It's not an ideal test as it isn't a mimick of our live environment. I'm going to post a question on MSDN and asp.net to see if any Microsoft folks can add anything more definitive. I will post back here with any updates.
Just because official support will end doesn't mean Microsoft will pull the plug and force an uninstall of .NET 1.1 via Windows Update. It only means that:
if a gaping hole in the framework's security is ever found, they'll not fix it;
There won't be redistributables for the next versions of Windows, and the next version of IIS won't run it.
So the application will still run in a year. If you leave the server alone, the application might run until the machine breaks of old age.
So my suggestion is relax, and focus more on the new solution.
I got the answer to this questions after reading this link (provided as an answer to this question on the ASP.net forums)
http://msdn.microsoft.com/en-us/library/ms994381.aspx
Under "Application Load Mechanisms and Possible Issues" it states:
By default, an application built using the .NET Framework will run using the version of the Framework it was built against if that version is installed on the computer
It then goes on to detail (for .net 1.1 and 2.0 at least) when a particular version of the framework is used.
Essentially, because our server has both 1.1 and 2.0 installed the application will still be using version 1.1. If 1.1 was not installed then it would run by default under 2.0, which explains why the web application still worked after I uninstalled .net 1.0 and 1.1 from my local machine.
Given that the live server is W2K3 and I can't remove .net 1.1, I will be rebuilding my application to target .net 4.0.

upgrading to framework 4.0

I have a solution which contains 18 projects and targets framework 3.5. It also includes web installer project. When i am trying to upgrade the solution to framework 4.0, it gives me lots of errors and doesnt convert web projects and web installer projects.
Is there a way to convert projects manually rather than relying on visual studio wizard?
.wdproj files are not getting converted.
Error Log:
Project file opened successfully
No Conversion Required
Get root element Project successfully
No Conversion Required
ToolsVersion in String:
3.5
ToolsVersion in DWORD:
3.5
Require Upgrade
Ready to exit
Require Upgrade
I understand that you want to change your framework for all the solutions from 3.5 t0 4.0
I think you can set that in visual studio 2010.
Open your entire solution in VS2010.
right click on the project (do this for all the projects you have)
then select properties.
Click on compile tab on the left side .
click on advanced compile options
change the target framework to 4.0
I'm not sure but I thought of sharing this idea.
Let me know if this works.
I always have kind of a hard time finding the setting in visual studio for changing the version of .NET. And even then sometimes it has been greyed out (unchangable) through VS GUI. The way I typically change .NET is by opening your .sln file in notepad. In a Visual Studio 2010 .sln file there should be a line in there something like:
TargetFrameworkMoniker = ".NETFramework,Version%3Dv3.5"
Just change it to:
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Save, and you should be good to go.
If you really want to change your framework through the GUI in Visual Studio 2010 for an asp.net project you can right click on your website (one tier under "Solution" in "Solution Explorer"). Select "Property Pages", then in the new window "Build" which has a field called "Target Framework" where you can change your .NET Framework.

How to properly set up Application Pools for IIS6

I am really stuck with this Parser Error Message telling me "Could not load the assembly 'App_Web_amlohswi'. Make sure that it is compiled before accessing the page." I have been looking around for a few hours checking different posts here and googling information. I have found out that I need to set up a new Application Pool that runs .NET 2.x.
(On a side note, my app is being developed in .NET 3.5, is there a way to set it up to use 3.5 instead of 2.x?)
Can someone provide me with a good explaination on how to set this up properly and (optionally) why is it necessary?
I am more used to developing in PHP so I am used to edit src >> upload >> success!
Thanks!
ASP.NET 3.5 sites run in 2.0 app pools as long as that version of .NET is installed on the system.
You may have to set up web.config properly. Visual Studio should do this for you when you create a new project.
You should also make sure you don't combine 1.1 and 2.0 applications in the same app pool. Try putting it in a separate app pool and see that helps.
Since #Trull provided you with a link to the "how", I'll chime in with the why.
.Net 3.5 just builds on the base .Net 2.0 libraries so you don't need to set it up for 3.5. .Net 2.0 and .Net 1.1/1.0 share some of the same name spaces and classes and therefore you need to choose which set of libraries you want to use with your application. Since your application uses the libraries from .Net 2.0, you need your app pool set up to load these libraries for your application rather than the .Net 1.1 libraries. You will also need .Net 3.5 installed on the web server, even though you only configure the app to use the (base) .Net 2.0 libraries.
This would basically be the equivalent of different versions of PHP. You would expect an application written using PHP 5 (and taking advantage of constructs in PHP 5) to work with a PHP4 interpreter. You'd need to upgrade to the newest interpreter (or at least choose the newer one if both are installed) before your app would work. It's the same with .Net -- you need to choose the right version, the version that your code expects to reference before it will work.
Here is how you use 3.5 in IIS. All hail Hansleman!

Resources