2

I want to downgrade one of our application which is currently targeted to .net framework 4.6.1 to lower version 4.5.2. This application has many dependent projects and several libs installed with Nuget. Below are the steps I followed to downgrade.

  1. Converted each project of application and all dependent projects to target 4.5.2
  2. Run following command to uninstall and reinstall all dependent packages from Nuget.

    Update-Package -Reinstall

  3. This step is not required but to be sure, i deleted packages folder and then allowed Visual Studio to download it again when i built the solution.

After all the above steps when i publish the site or create a build with TFS and deploy it to IIS and run it i get below error.

.NET Runtime version : 4.0.30319.36373 - This application could not be started.This application requires one of the following versions of the .NET Framework:
 .NETFramework,Version=v4.6

Do you want to install this .NET Framework version now?
ARV
  • 1,111
  • 5
  • 22
  • 46
  • Please check the httpRuntime in web.config has correct .NET version as its "targetFramework" – Nirman Jan 09 '18 at 13:39
  • The httpRuntime and compilation both have proper target framework set – ARV Jan 09 '18 at 13:41
  • See [Weird Error Upgrading ASP.NET MVC from 4 to 5](https://stackoverflow.com/a/35991676/). Visual Studio doesn't have a proper "upgrade" or "downgrade" feature because of all of the permutations of different versioned components - the only solution to ensure all `.csproj`, `Web.config` and `packages.config` are in sync is to do it manually. – NightOwl888 Jan 09 '18 at 13:53
  • The problem finally was because of system.codedom Compiler section that was added in the web.config for the 4.6 version, this did not get updated when the version was changed to 4.5.2. After i removed the section it started working for me – ARV Jan 10 '18 at 09:16

1 Answers1

0

The problem finally for me was because of system.codedom Compiler section that was added in the web.config for the 4.6 version, this did not work when the version was changed to 4.5.2. After I removed the section it started working for me

<system.codedom>
<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>

ARV
  • 1,111
  • 5
  • 22
  • 46