1

I just had to downgrade my ASP.Net 4.5 application to an ASP.Net 4.0 application, because our servers don't support 4.5. The way I downgraded it was pretty simple:

Project -> Properties -> Application -> Target Framework Target framework

When it finished doing stuff, I restarted the solution, tried to start debugging, but it stopped right after I started debugging, giving me first some errors (which say they can't find some namespaces) for a fraction of a second and after the errors disappeared it gives me 127 warnings that all look like this:

Warnings

Now I know what the problem is here, but I don't know how to solve this issue.. Does anyone know how to fix these warnings?

Thanks in advance

INFO

I'm using Visual Studio 2015 Community

M Zeinstra
  • 1,931
  • 4
  • 17
  • 46
  • See [this answer](http://stackoverflow.com/a/35991676/181087). "Upgrade" and "Downgrade" are not always features that can be counted on in Visual Studio - usually they require some manual intervention to ensure all of the references are consistent through multiple projects. – NightOwl888 Jun 23 '16 at 14:41

2 Answers2

0

Remove your current references to the Dlls in question and them add them again, it should load the correct versions of the Dlls. Because you had references to the 4.5 versions and then changed the project target the references are invalid now because they are build against a higher version framework. Changing the projects framework version target does NOT update the references in most cases

Paul Swetz
  • 2,234
  • 1
  • 11
  • 28
  • How do I know which references I have to add again? – M Zeinstra Jun 22 '16 at 12:39
  • Do them one at a time and keep a list. Remove whatever is error-ing, re-add, build, repeat. – Paul Swetz Jun 22 '16 at 12:50
  • I've just removed `System.Net.Http`, but I can't find it anymore when I'm trying to add a reference.. Any suggestions? – M Zeinstra Jun 22 '16 at 12:53
  • 1
    That is only available in 4.5 and higher .net. If you only need the HTTP client and related you can use this nuget package instead but it MAY require code changes. https://www.nuget.org/packages/Microsoft.Net.Http/ See SO topic http://stackoverflow.com/questions/10308572/httpclient-does-not-exist-in-net-4-0-what-can-i-do for more information. – Paul Swetz Jun 22 '16 at 12:57
0

It is actually not that easy when it comes with ASP.NET. You have to go through all web.config(s) and downgrade referenced libraries. If its new project, just create new ASP.NET on .NET 4 and compare its web.config(s) with yours.

Jan Vargovsky
  • 183
  • 2
  • 8