开发者

Mono assembly folders?

开发者 https://www.devze.com 2022-12-08 19:25 出处:网络
On a windows system the registry has keys like: HKLM\\SOFTWARE\\Microsoft\\.NETFramework\\开发者_开发知识库v2.0.50727\\AssemblyFoldersEx

On a windows system the registry has keys like:

HKLM\SOFTWARE\Microsoft\.NETFramework\开发者_开发知识库v2.0.50727\AssemblyFoldersEx

for locations of dot net assembly folders other than the gac.

Does a non-win mono system have a way of retrieving these or was it just considered not important?


The registry is not cross platform. It is also not a good place to store your configuration data. DO NOT USE THE REGISTRY IN .NET UNLESS YOU ARE DEALING WITH LEGACY CODE.

The GAC is there to keep track of global assemblies for you in both Mono and .NET. Any local assemblies should be kept with the rest of your program.

If you really need these locations (and you shouldn't), then you should manually specify these locations in a configuration file.

Why are you looking for the physical location of an assembly that is in the GAC anyway?


For starters, Mono on Linux stores the GAC as a list of files, paths, and links between the two. Most of the code which creates the base mono runtime utilizes a compile time flag named MONO_ASSEMBLIES. This value is set by default to $prefix/lib within the build system.

On most linux distros $prefix is set to "/usr", so MONO_ASSEMBLIES would be /usr/lib. With this in mind, the actual base paths for the GAC is $prefix/lib/mono/gac. You can also set an environment variable for the mono (MONO_GAC_PREFIX) which allows you to set multiple base paths for the GAC.

As this path can be changed per install and mono allows for multiple paths utilizing an environment variable, you might need to get the base path of Assembly.Location. Also, Assembly.GlobalAssemblyCache will help you determine if you need to check its path at all.

I hope this helps!

0

精彩评论

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