开发者

Registered an Assembly for COM, but only works on dev computer

Hey, I was wondering if you guys could see what is wrong/suggest a solution.

I have a dll Assembly for COM that I built with C#, and i am trying to get the COM object from Silverlight Out-of-browser. I want the siverlight application to be mobile between computers, so i put all the neccesary files in a zip along with a batch installer that does the followingto register the assembly:

cd %windir%\Microsoft.NET\Framework\v4.0.30319\ RegAsm.exe "%USERPROFILE%\My Documents\Homework Clock\windowsHook.dll" /tlb /nologo

My application finds the assembly and it works fine on my dev computer, but when I move my application to a test computer (along with the dll and any other neccesary files), my batch file says it registers successfully but the application doesn't find it.

However, when i rebuild the assembly with C# on the test computer and replace the dll i moved from the dev computer with the rebuilt dll, the application finds it fine. It would be convenient for my clients if they didn't have to rebuil开发者_C百科d the assembly using C# if they wish to use my application, so i was wondering if there was a way to fix this.

I looked into this problem for a while and thought it might be because my assembly wasn't a strong named assembly, since I think C# does that automatically, so i tried doing it in my batch file and it couldn't recognize the 'al' and 'sn' commands necessary to generate the cryptographic key to give an assembly a strong name, and i tried doing it in the 'signing' tab in the C# project properties, but i encountered the same problem. Any ideas how to fix this?

Thanks in advance


The reason it works when you rebuild with VS is because it runs Regasm.exe with the /codebase option. Required if you don't plan to put the assembly in the GAC.


C# does not automatically give assemblies a strong name. If you're using Visual Studio, open the project's Properties page, and look under the Signing tab. Check Sign the Assembly, and generate a new strong name key file. Build your project, and you should be able to do what you need to do with your existing batch file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜