Disable GAC Search

I am trying to use FSharp PowerPack for the ArgParser library, but I run into some serious problems on my machine, where it seems that the wrong version of FSharp.Core.dll from the GAC is loading, which then causes the ArgParser error load. Ideally, I would encounter a fix problem (since it works on my colleagues computers), but I tried all kinds of combinations of deleting and reinstalling FSharp binary files from the system to no avail.

As I don’t really like the fact that I can’t just remove the DLLs that are known to be correct in the executable due to the GAC, if there is any way to just disable the search in the GAC, I will happily do it.

I know this solution will be a bit hacky, but for now I just need to get it to load and work, and I will try something.

EDIT

Additional Information. Here is the load output for the project.

'PowerPackTest.exe' (Managed (v4.0.30319)): Loaded 'C:\WINNT\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'PowerPackTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Projects\PowerPackTest\PowerPackTest\bin\Debug\PowerPackTest.exe', Symbols loaded. 'PowerPackTest.exe' (Managed (v4.0.30319)): Loaded 'C:\WINNT\Microsoft.Net\assembly\GAC_MSIL\FSharp.Core\v4.0_4.0.0.0__b03f5f7f11d50a3a\FSharp.Core.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'PowerPackTest.exe' (Managed (v4.0.30319)): Loaded 'C:\WINNT\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'PowerPackTest.exe' (Managed (v4.0.30319)): Loaded 'C:\WINNT\assembly\GAC_MSIL\FSharp.PowerPack\2.0.0.0__a19089b1c74d0809\FSharp.PowerPack.dll' 'PowerPackTest.exe' (Managed (v4.0.30319)): Loaded 'C:\WINNT\assembly\GAC_MSIL\FSharp.Core\2.0.0.0__b03f5f7f11d50a3a\FSharp.Core.dll' 

As you can see, it first loads FSharp.Core v4, but then loads v2 on top of it at the last second. This does not happen on my machines.

+4
source share
3 answers

Pre-created PowerPack executables are compiled against CLR v2, and they also reference FSharp.Core v2. This is probably causing this problem. I really don't understand why the .NET version of PowerPack is not offered as a download (or in NuGet!), But you can get around these two ways:

You can configure assembly binding redirection , but I don't know if this will work for fsi.exe .

Or you can download the source code in F # PowerPack and compile your version of .NET 4. It's pretty easy.

+4
source

GAC always wins - this is a security feature. If you have a different version of FSharp.Core, why don't you drop it in the GAC and use the redirect in app.config to force the download of the new version or re-create the application (maybe it's impossible) against the new version?

-Oisin

0
source

I just looked at the .net 4.0 project, where I use ArgParser, I refer to FSharp.Core and FSharp.Powerpack, and also in app.config I have a redirect setting:

  <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0"/> </startup> 

Hth

0
source

Source: https://habr.com/ru/post/1343201/


All Articles