How do you program with the GAC?
-
All Happy Now! We have an existing ASP.NET app (C# backend) that was originally written with weakly named backend objects, distributed to our customer's via traditional "XCOPY" (actually InstallShield, but just dropping files in the right location), so that all of the necessary DLL's are installed in the /bin directory of the default website. This works fine for just one app. Now, we are in the process of adding additional applications to our existing one, and in order to do that, we are strong-naming our components and trying to install them to the GAC, so that they can be globally referenced. I have successfully strong-named all of our components, and can put them into the GAC without issue as well. However, when I remove the /bin directory after having placed the components in the GAC, I get "Object Not Found" errors when trying to run the app. Is there something I need to change in the way my .DLLs reference each other, so that the app will search the GAC when loading? This is somewhat urgent as we are midway through the design process and starting to reconfigure our existing code. If our distribution plans are misinformed, we need to know now so we can lay a better path. Thanks for any help we can get!
-
All Happy Now! We have an existing ASP.NET app (C# backend) that was originally written with weakly named backend objects, distributed to our customer's via traditional "XCOPY" (actually InstallShield, but just dropping files in the right location), so that all of the necessary DLL's are installed in the /bin directory of the default website. This works fine for just one app. Now, we are in the process of adding additional applications to our existing one, and in order to do that, we are strong-naming our components and trying to install them to the GAC, so that they can be globally referenced. I have successfully strong-named all of our components, and can put them into the GAC without issue as well. However, when I remove the /bin directory after having placed the components in the GAC, I get "Object Not Found" errors when trying to run the app. Is there something I need to change in the way my .DLLs reference each other, so that the app will search the GAC when loading? This is somewhat urgent as we are midway through the design process and starting to reconfigure our existing code. If our distribution plans are misinformed, we need to know now so we can lay a better path. Thanks for any help we can get!
This doesn't directly answer your question, but I wouldn't put assemblies into the GAC during development. This can be a real pain, because you have to specifically tell gacutil to uninstall the assembly first or force it to re-install over an existing install: gacutil /f /i myassembly.dll But this fails if you've installed the assembly with MSI, because it can only be uninstalled using MSI! It's easier to add things to the GAC as part of installation and test the installation separately--NOT on the development platform. Use VirtualPC or something to ensure a clean, reproducable install environment. Marc MyXaml Advanced Unit Testing YAPO
-
This doesn't directly answer your question, but I wouldn't put assemblies into the GAC during development. This can be a real pain, because you have to specifically tell gacutil to uninstall the assembly first or force it to re-install over an existing install: gacutil /f /i myassembly.dll But this fails if you've installed the assembly with MSI, because it can only be uninstalled using MSI! It's easier to add things to the GAC as part of installation and test the installation separately--NOT on the development platform. Use VirtualPC or something to ensure a clean, reproducable install environment. Marc MyXaml Advanced Unit Testing YAPO
Thanks, but distribution is what I'm trying to test at this point. We've already got the development environment running and compiling together with the strong-named assemblies. It's when I try to test how the application works with its core dlls in the GAC that I'm running into trouble. One thing that I'm doing that may not be right is I'm using the Windows Explorer add-on to install the dlls to the GAC, not GACUtil. I wouldn't think that's the problem, because I get the same failures when I use the InstallShield distribution. So I figured it has something to do with how we reference the DLLs. Thanks for looking and responding! Kerry
-
All Happy Now! We have an existing ASP.NET app (C# backend) that was originally written with weakly named backend objects, distributed to our customer's via traditional "XCOPY" (actually InstallShield, but just dropping files in the right location), so that all of the necessary DLL's are installed in the /bin directory of the default website. This works fine for just one app. Now, we are in the process of adding additional applications to our existing one, and in order to do that, we are strong-naming our components and trying to install them to the GAC, so that they can be globally referenced. I have successfully strong-named all of our components, and can put them into the GAC without issue as well. However, when I remove the /bin directory after having placed the components in the GAC, I get "Object Not Found" errors when trying to run the app. Is there something I need to change in the way my .DLLs reference each other, so that the app will search the GAC when loading? This is somewhat urgent as we are midway through the design process and starting to reconfigure our existing code. If our distribution plans are misinformed, we need to know now so we can lay a better path. Thanks for any help we can get!
Another Link under .NET Framework had it: http://www.codeproject.com/script/comments/forums.asp?msg=1071155&forumid=12076&XtraIDs=1649&searchkw=GAC&sd=1%2F29%2F2005&ed=4%2F29%2F2005#xx1071155xx