|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
frameworrk and GAC components(but less sophisticated than) the Visual Studio project references dialog. The reason for this is that my app supports scripting by dynamically compiling VB.NET code (via CodeDom.Compiler), and I want to provide for the selection of references required by the user's script project. So I want the app to present a list of assemblies installed in the GAC, including available framework system assemblies (e.g., System.Xml, System.Data, System.Windows.Forms, etc.). Is there a managed mechanism to enumerate GAC assemblies? In searching about, I've found "DOC: Global Assembly Cache (GAC) APIs Are Not Documented in the .NET Framework Software Development Kit (SDK) Documentation" (http://support.microsoft.com/default.aspx?scid=kb;en-us;317540). But this looks like C++, and I was hoping for a C# solution (I could even live with/translate VB.NET). Anyone have an idea of how to accomplish this? Thanks >Is there a managed mechanism to enumerate GAC assemblies? Not in the framework, not. But you can call those COM APIs from C# ifyou want. But the GAC has nothing to do with compile time references. It's only used when loading the assembly at runtime. The VS Add Reference dialog, for example, does not list the contents of the GAC. Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. Thanks Mattias,
So what does the VS Add References dialog use? How can I get the list of available references? My dialog has a Browse button (for adding references not in the GAC), but if you navigate to the GAC with the file open dialog, you get the same "funky" view of the GAC that Windows Explorer shows (provided by SHFusion.dll), and you can't actually select anything in the dialog. Emby Show quote "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message news:uhCpTku1GHA.2176@TK2MSFTNGP04.phx.gbl... > >>Is there a managed mechanism to enumerate GAC assemblies? > > Not in the framework, not. But you can call those COM APIs from C# if > you want. > > But the GAC has nothing to do with compile time references. It's only > used when loading the assembly at runtime. The VS Add Reference > dialog, for example, does not list the contents of the GAC. > > > Mattias > > -- > Mattias Sjögren [C# MVP] mattias @ mvps.org > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com > Please reply only to the newsgroup. >So what does the VS Add References dialog use? The framework directory (%WINDIR%\Microosft.NET\Framework\vX.Y.ZZZZ)plus any additional directories listed in the Registry, as explained in this article http://support.microsoft.com/?kbid=306149 Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. Thank you Mattias,
FYI, I've poked around a bit more, and here's what I've found: HKLM\SOFTWARE\Microsoft\.NETFramework\InstallRoot Gives the root folder of all installed framework versions; append the version (e.g., "\v2.0.50727 ") to get the folder where a given framework's dll files are installed As the article notes: HKLM\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders (and HKCU) But I also found: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx This yields other VS components (like PIA's) and other public assemblies. I have one more related question, which I'll post in a separate message - I basically want to know if there is an easy/quick way to programmatically identify a .NET assembly (EXE or DLL). One of the assembly folders you get from the registry can have many files, but only 1 or 2 of which are .NET assemblies. Is there a way to find them (other than trying to load each as an assembly)? Thanks so much for your help. Emby Show quote "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message news:O$uyFT31GHA.4264@TK2MSFTNGP05.phx.gbl... > >So what does the VS Add References dialog use? > > The framework directory (%WINDIR%\Microosft.NET\Framework\vX.Y.ZZZZ) > plus any additional directories listed in the Registry, as explained > in this article > > http://support.microsoft.com/?kbid=306149 > > > Mattias > > -- > Mattias Sjögren [C# MVP] mattias @ mvps.org > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com > Please reply only to the newsgroup. |
|||||||||||||||||||||||