Posted Monday, June 05, 2006 2:41 PM
|
|
|
|
| I have a problem: I want to add a new library .dll (not bluebit) to my project and system don´t allow this: "Unable to emit assembly: <error message>]". I open a new project and this time, there is not problem with this, dll works fine. Is something to do with bluebit public and private key interferences? , what can i do in order to add this new library?
|
|
Posted Monday, June 05, 2006 11:39 PM
|
|
|
|
Hello Guille,
I can think of one possible explanation. The project that has generated the DLL was not signed. Try signing this project, recompile the DLL, and then add the reference to it in your main project.
Your project using NML is a signed one. Signed assemblies can only use other signed assemblies.
Let me know if the above has solved the problem
Trifon Triantafillidis | Lead Developer |
|
|
|
Posted Tuesday, June 06, 2006 3:07 AM
|
|
|
|
you said "Try signing this project, recompile the DLL, and then add the reference to it in your main project".
how can i sing this project?, I remember the first time using sn.exe tool but, should I turn to sing again. I don´t understand very well the methot to sing a project. what is the rigth operation, sing a project or a dll?
sn -k and sn -p?
|
|
Posted Tuesday, June 06, 2006 3:29 AM
|
|
|
|
Hi
You can sign the project by simply inserting the AssemblyKeyFileAttribute in the AssemblyInfo source file. This is exactly the same as you did in your main project (the one that uses BNML) and you do not need to generate a new keyfile with sn.exe utility, you may use the same keyfile.
[VB]
<Assembly: AssemblyKeyFile("MyKey.snk")>or<Assembly: AssemblyKeyFileAttribute("MyKey.snk")>
[C#]
[Assembly: AssemblyKeyFile("MyKey.snk")]or[Assembly: AssemblyKeyFileAttribute("MyKey.snk")]
Trifon Triantafillidis | Lead Developer |
|
|
|
Posted Tuesday, June 06, 2006 3:35 AM
|
|
|
|
I supose I have to fill:
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
in the .dll source code Don´t I?
|
|
Posted Tuesday, June 06, 2006 3:46 AM
|
|
|
|
No,
1) You will NOT make any changes in your main peoject which uses BNML and your DLL
2) In your DLL's project you will have to add in the AssemblyInfo.cs source file
[assembly: AssemblyKeyName("XXXXXX.XXX")]
where XXXXXX.XXX is your keyfile, the file that you have generated with sn.exe and contains both the private and public signing key.
Just copy the command from your main project and copy it in the AssemblyInfo of your DLL's project. Also copy the keyfile and place it in the DLL's project folder.
Trifon Triantafillidis | Lead Developer |
|
|
|
Posted Tuesday, June 06, 2006 2:13 PM
|
|
|
|
thank you again Trifon,
it seems is working
I apreciate your support
Guille
|
|
Posted Tuesday, September 19, 2006 1:22 PM
|
|
|
|
Hi,
I have a similar problem with a .net framework .dll. I want to extract some results in a excel sheet and I added Microsoft Excel 9.0 Object Library (interop.excel). The problem is that this dll are not signed. ¿what can I do if this dll is not a library project (.dll project)?
|
|
Posted Tuesday, September 19, 2006 1:47 PM
|
|
|
|
Guille,
Have a look here http://www.bluebit.gr/forum/topic.asp?TOPIC_ID=45
This might be a solution.
Another solution is to manually sign the created Interop dlls (look in the bin folder) using the sn.exe tool and your private-public key pair.
Trifon Triantafillidis | Lead Developer |
|
|
|
Posted Tuesday, September 19, 2006 3:43 PM
|
|
|
|
| I heve been tried to sing Interop.Excel.dll but how to do it? I have tried generating a pair of public-private keys with sn and then sn -R but says that it doesn´t represent an asambly with sure name. Could you give me more information?
|
|
Posted Wednesday, September 20, 2006 3:11 AM
|
|
|
|
Guille,
I am sorry but you are right, sn.exe cannot work this way.
Actually there is a simpler way:
In the Solution Explorer right click on your project's name and select "Properties". This will display the properties of your VB or C# project.
In "Common Properties -> General" set the "Wrapper Assembly Key File" property to a valid key file (you DO NOT have to create a new one - you can use the same as the one you use to sign your project in the AssemblyInfo )
When a .NET project references a COM components (such us the Excel Object Library) it does not do this directly but through "wrapper dll's". Setting the above property "Wrapper Assembly Key File" forces those wrappers to get signed.
Trifon Triantafillidis | Lead Developer |
|
|
|
Posted Wednesday, September 20, 2006 2:45 PM
|
|
|
|
Hi Trifon:
I think that is only for a C# project. i have not "Wrapper Assembly Key File" property in the project properties. I´ll research how to do it for VB.net. If I find the solution, I share it in this forum.
Thanks.
Guille
|
|
Posted Wednesday, September 20, 2006 3:10 PM
|
|
|
|
If it is VB project then: http://support.microsoft.com/?kbid=313666
Trifon Triantafillidis | Lead Developer |
|
|
|
|
|