I upgraded my ASP.NET CORE application from sdk .NET Core 2.0 to .NET Core 2.1. I can run the solution in my localhost but when I deploy it to another server there is an exception. And the exception is below. The steps I have done to solve the issue so far are below and it throws the same error with all the modification that I did seems nothing works. Does anybody have any suggestion how to solve this issue?
Steps I've done:
Modify the setting for the project
<PropertyGroup> <TargetFramework>netcoreapp2.1</TargetFramework> <Platforms>AnyCPU;x64</Platforms> <RuntimeFrameworkVersion>2.1.0</RuntimeFrameworkVersion> <UseNETCoreGenerator>true</UseNETCoreGenerator> <RazorCompileOnBuild>true</RazorCompileOnBuild> </PropertyGroup>
I also added binding redirect in the web.config
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.1.0" <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.1.0" /> </dependentAssembly> </assemblyBinding>
Install .net core 2.1 on the server
- I also deleted my .vs folder and close my visual studio and open it again.
Exception :
Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred:error CS1705: Assembly Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'