Apps failing to start, how to reset .NET Frameworks' Global Assembly/Access Cache ? #GAC

nn-3559 1 Reputation point
2023-10-07T09:43:32.2+00:00

i added some Assemblies to .NET Framework's Global Access Cache, by a not-overwriting command of gacutil.exe . and some apps stopped working, 1 of them showed this error:

Unhandled Exception: System.TypeLoadException: Could not load type 'System.Diagnostics.Process' from assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=<<..>>'.
   at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.MainCore(String[] args)
   at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)

removing the added content didn't help .

but after reinstalling .NET Framework 4.8 Runtime i started getting this error instead

error CS7065: Error building Win32 resources -- Could not load type 'System.Numerics.BigInteger' from assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

i also catched this

System.TypeLoadException: Could not load type 'System.ComponentModel.DataAnnotations.ValidationResult' from assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=<<..>>'.
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication..ctor(CommandLineApplication parent, IHelpTextGenerator helpTextGenerator, CommandLineContext context)

how to fix this ?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,667 questions
Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
4,771 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,125 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. nn-3559 1 Reputation point
    2023-10-07T13:28:19.4366667+00:00

    solution:

    • i allowed access to %windir%\Microsoft.NET\assembly by changing it's permissions, then terminated all Explorer processes and moved all content of the folder out to temp folder .
    • ran sfc /SCANNOW in Elevated Command Prompt, it restored GAC_MSIL and fixed 1 app .
    • copied other folders back to the assembly and that fixed the other ones .
    0 comments No comments