RegAsm .net 4 Error, Could not load itself? - .net-4.0

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.

Related

Could not load file or assembly 'NetTopologySuite, Version=1.13.4693.18484

ok, here's the situation.
I have two projects:
ASP.NET MVC 4 (references class library)
Class Library (Added RavenDB and Net Topology Suite from NuGet)
When I try to run 'SpatialGenerate' in any index, I get the following error:
Could not load file or assembly 'NetTopologySuite, Version=1.13.4693.18484, Culture=neutral, PublicKeyToken=f580a05016ebada1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I am using .net 4.5 of course and I'm doing this in VS 2012 on Windows 8. I have tried hosting this in IIS/IISexpress and the cassini server. I have checked that the file and it's related files are all present in the bin/debug directories and their versions are accurate. I also created a unit test that calls the queries via the index and I get the same error.
I have searched everywhere and I can't seem to find anything. Furthermore, once I was able to execute the index and everything worked, but I don't know why and can't make it happen again.
You need to use the RavenDB.Ebmedded package or add RavenDB.Database

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

How do I use COM reference within SSIS package?

I'm trying to use the Microsoft Shell Controls And Automation COM object library (C:\Windows\System32\shell32.dll) from within an SSIS Script Task to manipulate .zip archives.
Unfortunately, although I have successfully added the relevant Reference and the Script Task compiles OK. I'm using VB.NET, for what it's worth. I get the following runtime error as soon as I try to create any objects defined within the library:
Error: 0x1 at Archive File: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Interop.Shell32, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'Interop.Shell32, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
at ST_a2650b7f39504eaa8c80e37a6736d957.vbproj.ScriptMain.Main()
I thought the Interop DLL would all be taken care of for me - does anyone know what step am I missing?
SSIS needs all .dll references to be registered with the GAC, you are correct.
You have different options regarding installing this dll into the GAC:
Drag and drop the .dll into the %windir%\assembly\ folder.
Use the gacutil.exe you are thinking about using: Regarding installing into the GAC using the gacutil, there is alot of useful information here: Global_Assembly_Cache. Basically, if you have the .NET framework installed (you are using VB.NET so no problem there), you will have a gacutil.exe in your Microsoft.NET folder.
(What I normally use when all else fails) Create a windows MSI project in Visual Studio that automatically does all this for you, useful info here: How to install assembly in the GAC using MSI
If you install that .dll in the GAC and you are still having problems, another option is to actually create a separate visual studio project that contains your logic for manipulating the needed zip files build it and call its exe from SSIS using the Execute Process Task. You can pass arguments specified in the SSIS package. Not very elegant, but it gets the job done if you are keen on using SSIS.
UPDATE:
The solution in this question did the trick SSIS Script Task COMException / FileNotFoundException error. The problem was in adding a signed reference of the dll, this answer provides a good step-by-step workaround for adding a COM reference within the SSIS Script Task.

How to create a Type Library of System32 dll?

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.

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.