简体   繁体   中英

WPF application register assemblies in the GAC?

Based on performance guidance from Microsoft, it appears adding an assembly to the GAC can help improve performance of an application's startup time. If I register my application's assemblies with the GAC, should my projects reference the GAC'd assemblies or the project references?

ApplicationFoo.csproj

references:

Library1.csproj

but I sign and register Library1.dll in the GAC.

Should ApplicationFoo.csproj have a reference to Library1.dll in the GAC or Library1.csproj?

Your project normally should reference assemblies not in the GAC, but somewhere in your source folder you put in your version control system. You can't do that with assemblies in the GAC.

When you run your application the .Net loader (fusion) will first look in the GAC and use those assemblies if it can find them. Otherwise it will look for assemblies next to your exe.

So although you could, with some work, reference assemblies in the GAC from your project you shouldn't. When you run you could put the assemblies in the GAC and you don't need to change anything for that, but you might only want to do that in production. It's easier to control your development environment if they are not in the GAC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM