I first started by trying to install the assemblies using the gacutil batch script I’d always been using – it looked something like this:
cd C:\temp\
gacutil /i MyAssembly.dll
cmd.exe
This all looks fine and is what you’d expect – I’d copied the gacutil from “C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin” on my dev machine to the same directory as the batch file (on the server) and then executed the batch file. I was then presented with the following error:
Failure adding assembly to the cache: This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
At this point I double checked that the .NET framework 4.0 was installed (which it was). It turns out that for .NET framework 4 assemblies, you have to use the newer gacutil, installed with Microsoft Windows SDK for Windows 7 and .NET Framework 4, found here: http://www.microsoft.com/download/en/details.aspx?id=8279.
So I installed the aforementioned SDK, got the newer gacutil (from C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\)and attempted again. This time I got no errors, but also no confirmation that the assembly was installed in the GAC. So I checked the GAC (%windir%\windows\assembly), and found that the assembly had not installed!
After a little more digging I found that the .NET framework 4.0 introduced a NEW GAC, meaning we have 2 GACs to manage – one for .net 2.0-3.5, and one for .net 4.0. The new .net framework 4.0 gac is located at %windir%\Microsoft.NET\assembly\ - so I checked this and to my shock, the assembly was not installed in there either!
Finally, I found my answer from MarkdeCates in this forum post: http://social.msdn.microsoft.com/Forums/is/netfxsetup/thread/8289751b-be25-4a23-a5e2-709645b8c651. It seems that as well as copying the gacutil.exe, we also need to copy gacutil.exe.config and gacutlrc.dll (which is located in the 1033 subfolder). If these additional files are not copied, the gacutil doesn’t throw an error…in fact it doesn’t do anything.
So I finally got there, albeit a little confused!!
Matt
0 comments:
Post a Comment