开发者

Disable Searching The GAC

I'm trying to use the FSharp PowerPack for the ArgParser library, but running into some serious issues on my machine where it seems to be loading the wrong version of FSharp.Core.dll from the GAC that then causes the load of ArgParser to fail. Ideally I would get the issue with that fixed (since it works on my coworker's computers) but I've tried all sorts of combinations of uninstalling and reinstalling the FSharp binaries from the system to no avail.

As I don't really like the fact that I cannot just drop the DLLs that are known to be the correct ones in the executable directory because of the GAC, if there is any way to just disable searching in the GAC I will happily do that.

I know that that solution would be a bit of a hack, but right now I just need to get this to load and work and I'll try anything.

EDIT

Some more info. Here's 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\Powe开发者_如何学CrPackTest\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 loads FSharp.Core v4 first, but then loads v2 over it at the last second. This does not happen on my coworker's machines.


The pre-built PowerPack binaries are compiled against CLR v2, and they reference FSharp.Core v2 as well. That's probably what's causing this problem. I don't really understand why a .NET 4 version of the PowerPack isn't offered as a download (or in NuGet!) but you can work around this two ways:

You can set up an assembly binding redirect, but I don't know if this would work for fsi.exe.

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


The GAC always wins - this is a security feature. If you have a different version of FSharp.Core, why don't you drop that in the GAC too and either use a redirect binding in your app.config to force loading of the newer version, or rebuild your app (may not be possible) against the new version?


I just looked at a .net 4.0 project where i am using the ArgParser, i am referencing the FSharp.Core and FSharp.Powerpack, as well as in the app.config i have the redirect setup:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜