How to create a Type Library of System32 dll? - com

I need to use msctf.dll(COM server for Text Service Framework).I used REGASM to create a tlb file.I am using .NET 4.0 and Visual studio 2012 .
Command:
REGASM c:windows/System32/msctf.dll \tlb:msctf.tlb
Error:
RegAsm : error RA0000 : Failed to load 'C:\Windows\System32\msctf.dll' because i
t is not a valid .NET assembly
finally i need to create a Interop library of msctf using tlbimp.exe and use it in C# text service .

Need to add environmental variable when using cmd
In case of VS2012 Native tools Command prompt then it will work straight away.

Related

RegAsm .net 4 Error, Could not load itself?

i just cant register some dll files that has been built with .net framework 4 in some systems that both client and extended versions of .net framework 4 is installed, when i copy regasm.exe from .net framework 4 folder and paste it among some dll files that i want to register them using regasm, it gives me this error :
"RegAsm : error RA0000 : Could not load file or assembly
'file:///file address/RegAsm.exe' or one of its dependencies.
Operation is not supported
. (Exception from HRESULT: 0x80131515)"
i use regasm like this :
M:\file address\RegAsm.exe M:\file address\myfile.dll
note : when i copy regasm from .net framework version 2 and use it, i don't have such a problem.
but i need to register some dll files that has been built with .net framework 4.
note 2 : i must add that in some systems like my system that visual Studio 2013 is installed, there isn't such a problem.
i saw questions like this with their own answers but their talking about this that regasm cant register some dll files, but in my case it gives error about its own self.
UPDATE
thank you jeff
I changed my registering command to something like this :
C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe M:\file address\myfile.dll
and now it's giving this error about my own dll files, but i know that i have all of the dependencies in the folder, this is the error :
RegAsm : error RA0000 : Could not load file or assembly
'file:///M:\file address\myfile.dll' or one of its dependencies.
Operation is not supported. (Exception from HRESULT: 0x80131515)
RegAsm is a .NET application with its own dependencies. The CLR is failing to load one of those dependencies when you copy the exe by itself to another computer. If .NET 4 is in fact installed on that computer, RegAsm.exe should be in the .NET directories under Windows and you shouldn't need to copy it from another computer.

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.

TFS Build 2010 CodeActivity: Cannot Load Assembly in XAML

I am attempting to add a custom “activitycode” to a TFS Build. I wrote this months ago and had it working on a now defunct test environment. I am attempting to resurrect the use of the code onto a new test platform, and am running into issues.
When I open my build.xaml, I receive the dreaded red-box of pain where my custom activity should be, stating “Assembly could not be loaded because of an error in the XAML.” In the ErrorList, I also have found “Could not find type '.DeploySSRSReportActivity' in assembly 'ReportingServicesDeploy'.”
I have confirmed that my DLL is checked into source control and that the build controller is pointing to it.
Peeking into the raw XAML, I see that the build.xaml file defines the assembly as
xmlns:rsd="clr-namespace:;assembly=ReportingServicesDeploy
The line where my custom activity (and where V.S. finds the error) is:
<rsd:DeploySSRSReportActivity CurrentBuild="[BuildDetail]"
SourcesDirectory="[SourcesDirectory]"
mtbwt:BuildTrackingParticipant.Importance="High"
xmlns:mtvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client"
xmlns:mtvco="clr- namespace:Microsoft.TeamFoundation.VersionControl.Common;assembly=Microsoft.TeamFoundation.VersionControl.Common"
xmlns:ras="clr-namespace:ReportingServicesDeploy;assembly=ReportingServicesDeploy"
xmlns:rsd="clr-namespace:;assembly=ReportingServicesDeploy"
xmlns:sad="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
xmlns:sad1="clr-namespace:System.Activities.Debugger;assembly=System.Activities" />
The DLL is named ReportingServicesDeploy.dll. The namespace within the DLL is ReportingServicesDeploy, and the name of the activity class is DeploySSRSReportActivity.
Where is the linkage failing so that I am getting that error?
When your attempting to edit the xaml your doing this on your machine directly, tfs and sourcecontrol is not involved, the location on server for controller is where build agent will look for assemblies during the build and where VS will get them when opening build definition for config.
Your error possibly is coused by old version being used.
The assemblies must be available for visual studio on your machine - one option is to add them to GAC or to post in VS bin folders. Start new instance of studio afterwards
To intall into GAC run this from Visual Studio command line:
gacutil /i "Path\To\YourAssembly.dll"
To remove assembly run following from Visual Studio command line:
gacutil /u "YourAssembly"
For studio assemblies i believe this is the folder:
Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies

registering .net assembly as com

I have a C# class library which calls a native code DLL. I am trying to call this code from VBA.
I configured MSVC to register the generated DL and it works fine. I can access objects in DLL and work with them without any problem.
I want to register them in another computer and I am using the following command:
%windir%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe /tlb /v MyNetAssembly.DLL
The command return successfully but when I am trying to use the dll objects in VBA, I am getting error file not found (80070002). I tried to add path to the place that dll resides, copy the dlls to windows directory, using /codebase option, without any success.
What is the problem and how can I solve it?

Using tlbexp.exe on a COM dll

I am trying to set up communication between Centura and a COM .dll. (Downloaded from http://download.resip.fr for a database import)
Centura requires a .tlb file to be able to communicate to this component. Normally I would use regasm /tlb to generate the .tlb but seeing as it is a COM .dll this is not possible.
I found that I could use tlbexp for .NET dll's: http://msdn.microsoft.com/en-us/library/hfzzah2c(v=vs.80).aspx
I tried this out, knowing it would probably fail (as I have COM .dll). I received this error:
TlbExp : error TX0000 : Could not load file or assembly 'file:///C:\Windows\system32\ResipBcb.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
Using Dependency Walker I noticed two .dll's missing. I found ieshims.dll online but I can't find the wer.dll. See this question.
I don't know if the tlbexp failure has anything to do with this file that is missing?
To sum up, my question is:
How do I get a .tlb from this .dll? I can't seem to find any way to extract the .tlb out of this COM .dll.
Best regards
Clint Cambier
What you are trying to do only works for .NET assemblies, not native COM servers. The type library for them is almost always embedded inside the DLL. In Visual Studio, use File + Open + File and select the DLL. Open the "TYPELIB" node, right-click the resource (usually 1), Export. Save it to, say, a project directory, use the .tlb filename extension.
TblExp and regasm are only valid on .NET assemblies, what you have is most likely a standard non .NET COM DLL. So neither of those two commands are valid on this DLL.
Standard COM objects are registered using regsvr32. Try running that against your DLL and see if it registers correctly. If it does you should see it listed in Centura's ActiveX explorer.