I recently changed the target framework of my Cloud Service to .NET 4.8 from .NET 4.7.2. However after doing so, I have received a lot of errors.
Listing a few errors here:
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Cannot define a new extension method because the compiler required type 'System.Runtime.CompilerServices.ExtensionAttribute' cannot be found. Are you missing a reference to System.Core.dll?
The type or namespace name 'IEnumerable<>' could not be found (are you missing a using directive or an assembly reference?)
'ContentServerConfiguration.AllowedUnauthenticatedPathPrefixes' in explicit interface declaration is not found among members of the interface that can be implemented
Predefined type 'System.Int32', 'System.Object', 'System.String', 'System.Linq' is not defined or imported
For resolving
Predefined type System.String, System.Void and System.Object not defined or importederror, I tried deleting all the bin, obj and .vs folders. Ran the dotnet restore command which showed "there is nothing to restore" and restarted the solution. However the errors pertained.I also tried to add references again to project. It then showed a pop-up that "mscorlib" and "System.Core" are automatically referenced by the build system.
I also tried to add the necessary assemblies like this:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.IdentityModel" culture="neutral" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
However the error still pertained post rebuilding.
- I event tried adding the below code in Web.Config file of the project:
<compilation debug="true" targetFramework="4.8">
<assemblies>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
Didn't provide any resolution.
- I unloaded and then loaded the project with dependencies, still, didn't make any change.
Really need help as to what should be actually done to resolve the errors I am facing post upgrading to .NET framework v4.8, given that downgrading back to v4.7.2 is not an option.