GACUtil "Assembly successfully added to the cache" but "Number of items = 0" - gac

Why, when I run:
gacutil –i myAssembly.dll
do I get:
Assembly successfully added to the cache
But then when I run:
gacutil –l myAssembly.dll
I get
Number of items = 0
?

try with
gacutil –l myAssembly
donot add .dll at last.So if the dll is registered in GAC it will display
Number of items = 1
http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx

Silly reason, really, but it took me what felt like hours to fix and is not really something you want to have to deal with when you’re in the middle of trying to figure out a complex problem.
To add the assembly to the GAC you need to specify the .dll extension, but when trying to query it or unregister it you must NOT specify the .dll extension.
Running
gacutil –l myAssembly
will return
Number of items = 1

Related

How to check GAC assembly details on Windows Server 2012?

How can you check GAC assembly details Windows Server 2012? I managed to register a DLL via Powershell, now I need to verify that it is really done.
You are probably looking for the custom look of the GAC directory that you were familiar with in .NET versions prior to 4.0. Which stored the GAC in the c:\windows\assembly window and used a custom shell extension to flatten the directory structure into a list of assemblies.
The shell extension is no longer used for .NET versions 4.0 and up. You have .NET 4.5 on that machine, its GAC is stored in c:\windows\microsoft.net\assembly. You just get to see the actual directory structure. Locating the assembly isn't that difficult, start in the GAC_MSIL directory and you should have no trouble locating your assembly there by its name. Locate the folder with the same display name as your assembly. It will have a subdirectory that has an unspeakable name that's based on the version and public key token, that subdirectory contains the DLL.
If your assembly is a mixed-mode assembly created with C++/CLI then you'd start from either the GAC_32 or GAC_64 directory.
just try with this path
C:\Windows\Microsoft.NET\assembly
An option would be to use PowerShell. I've created a PowerShell module which allows you to see and manipulate the GAC contents. You can find it here.
# Show the assemblies in the GAC, including the file version
Get-GacAssembly SomeCompany* | Format-Table -View FileVersion
The gacutil.exe has a parameter to do this. If you run
gacutil.exe /l
You will get a list of registrations.

ILMerge & Keep Assembly Name

I need to merge some dlls and both the file name and assembly name need to be the same as for my main dll (mydll.dll). I also need the pdb file. How do I get this done?
Here are a few things I tried:
Just use ILMerge mydll.dll .... /out:mydll.dll
This fails with "Access to the path ...mydll.pdb is denied."
Rename mydll.dll to mydllTemp.dll and mydll.pdb to mydllTemp.pdb and then
ILMerge mydelltemp.dll .... /out:mydll.dll
This fails with "The pdb associated with ...mydlltemp.dll is out of date" I think this is because ilmerge looks at the assembly name to find the pdb, hence it looks for mydll.pdb which was renamed.
Rename mydll.dll to mydllTemp and then
ILMerge mydelltemp.dll .... /out:mydll.dll
This works without errors but when I attach the debugger to a process it does not trigger
ILMerge mydll.dll ... /out:mydlltemp.dll
rename mydlltemp.dll to mydll.dll and mydlltemp.pdb to mydll.pdb
Now I can attach the debugger to a process with breakpoints being triggered. However, the assembly name now is mydlltemp instead of mydll
So how can I get this to work AND have the original assembly name?
You didn't really mention is this is in the course of standard development or if this is part of a build process.
If it's for standard development, do you really need everything merged just to test things out?
If it's for your build process, you can have the output go to a different directory (which you will probably need to mkdir first) and then you can reuse the same assembly name.
merge to another directory, use /out:somedir\mydll.dll

How to unregister the assembly registered using regasm

I registered one of my dlls on the development machine using regasm as below (ASP application)
In a cmd prompt, I navigated to
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and did:
regasm /tlb "xxx.dll"
Now I made some changes in the dll. So I unregistered the dll using the command:
regasm /u xxx.dll /tlb:xxx.tlb
Then I registered the updated dll again with previous command. But the changes are not coming up in the project, so I doubt it's still pointing to the old dll. I restarted the machine, but that did not help.
So:
What are the ways to make sure my old dll is removed and the current one is new?
Is there any physical path to check them manually?
UPDATE: The below solution fixed the issue.
To Register:
SET WorkFolder= '<directory>'
regasm.exe %WorkFolder%\xxx.dll /Codebase
To unregister.
SET WorkFolder= '<directory>'
regasm.exe /unregister %WorkFolder%\xxx.dll
Try
regasm /u "[full path to your DLL in double quotes]"
To re-register use
regasm /codebase "[full path to your DLL in double quotes]"
ignore the warning.

Unregister type library on Vista

I've made a mistake in IDL file by increasing library version. After that I revert the version. Since the time I can't work with library, because VB6 still write : "There is new version of library * Do you want to upgrade to version 3.0" ....
in OLE/COM Object viewer I've seen registred some version of my library. Exist some way how to unregister these type library? I try to erase DLL and TLB files from computer, erase all keys from Windows registers ... But "Visual Basic 6" and "OLE/COM Object viewer" still have information about it.
Thx
Run regsvr32 /u Something.DLL to remove the DLL from the COM registration.
Use regsvr32 /u <path to file> from an elevated command prompt.
You need to unregister the DLL/TLB that contains the invalid version, otherwise the registry will still contain references to your 'mistake'. If you don't have the file any ore: increase the library version, recompile, and unregister.
This worked for me (lucky guess)
regasm.exe /unregister /tlb my.dll

My DLLs are strong named, but WSPBuilder reports they are not

WSPBuilder
Version: 0.9.8.0830
Created by Carsten Keutmann
GPL License 2007
Install and deploying [MYDLL]
Unable to deploy solution
Inner exception(1): This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for any assembly that will be in the global assembly cache.
I had the same issues but what worked for me was to delete all the files in the bin and obj folder and then rebuild the WSP.
In my case, I was getting some strange errors (can't remember the exact message) when using Delay sign only option for one project.
I have found the problem, but not the solution, it seems the project I have which is really a 12 hive, is also set to output a class library, this class library is getting included in the WSP.
So... I need to ensure the bin folder is really excluded from the build process.
I set the value in program files but no reaction yet...
Now going to restart the server...
Later: Ok - the fix is to restart the server, for some reason this helped
I'm experiencing the same issue, one solution, multiple projects, the one failing to compile is using an object from another project.
I've tried clearing the bin & obj folder, as well as restarting the server. I think I'll copy the files dll to the gac using gacutil instead.