Experience in C++, C#, Java and Process : Living in Montreal

* What is my technical experience as a software developer

* What I have learned in the software business

* Where I am heading to in my career

* How to process in a project

Tuesday, December 14, 2004

Solve "strong name" error in C# project

Error:

Assembly generation failed -- Referenced assembly 'Interop.Project1' does not have a strong name

Problem:
1. Add ShDocVw reference in my C# project
2. Make method calls
SHDocVw.IWebBrowser htmlDoc2 = (SHDocVw.IWebBrowser)this.Explorer;
string s = htmlDoc2.LocationURL;
3. Error when compiling

Solutions:
If a Visual C# .NET project references the COM Interop assembly, the COM Interop assembly is generated for you when you reference the COM dynamic-link library (DLL). You can specify the wrapper assembly key file in the Visual C# project properties as follows:

To strongly-name a VS-generated Interop assembly, you need to go to yourproject properties and in the Common -> General section, set the WrapperAssembly Key File to point to your SNK file. The path used is relative tothe csproj/vbproj file, so for a typical arrangement where the snk file iswith the sln file and the projects are in subdirs, then it'd be just"..\yourkey.snk"


0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home