Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2004

Tip: Looking for answers? Try searching our database.

aximp and delaysign

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sunny - 09 Jun 2004 22:03 GMT
Hi,
I'm trying to prepare ActiveX wrapper with delaysign. I use the
/delaysign and /publickey: options, but I receive:
AxImp Error: The /delay option should be used with /keyfile or
/keycontainer.

I'm using VS.Net 2003 and framework 1.1

In the docs it is written that I can use delaysign with publickey
option. And actually, if I have the private key (in keyfile) the whole
idea of delaysigning does not make sense.

What I'm doing wrong?

Thanks
Sunny
"Ying-Shen Yu[MSFT]" - 10 Jun 2004 02:54 GMT
Hi Sunny,

You are correct, this is a bug in .NET Framework 1.1 and the product team
is planning to fix it in Whidbey release.
For now you may use aximp /source option to generate the C# source for the
interop wrapper then delete the generated DLLs and PDB and keep
AxmycontrolLib.cs:

delete AxmycontrolLib.dll
delete mycontrolLib.dll

Then create another C# source file called __KeyFile.cs which contained the
following:

using System;
using System.Reflection;
using System.Runtime;
using System.Resources;
[assembly: AssemblyKeyFileAttribute(@"<full path>\public.key")]
[assembly: AssemblyDelaySignAttribute(true)]
Then I ran the following commands:

tlbimp /delaysign /publickey:<full path>\public.key mycontrol.ocx

csc  /target:library /r:mycontrolLib.dll AxmycontrolLib.cs  __KeyFile.cs

Does it resolve your problem?
If you still have problem on this issue, please feel free to reply this
thread.

Have a good day,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
Sunny - 10 Jun 2004 15:58 GMT
Hi Ying-Shen,
Thanks for your prompt replay, this solved the problem so far.

Now I have another problem:

My final output assembly should be registered for COM interop. It worked
before I start to delay sign everythig :)

I have followed the instruction and issued both:
sn -Vr *,<tocken>

and

sn -Vr myassembly.dll

But still when build the project, I receive:

COM Interop registration failed. The check of the signature failed for
assembly 'myassembly.dll'.

Can you help to solve this?

Thanks
Sunny
"Ying-Shen Yu[MSFT]" - 11 Jun 2004 03:44 GMT
Hi Sunny,

Glad to see you have resolved the previous issue,
For this COM Registration failure,
I'd like to confirm the assembly myassembly.dll is the output assembly of
your project?

Did you execute the sn -Vr command after opening the VS.NET IDE?
Have your tried restart the IDE after you adding them to Verification skip
list?
If this could not resolve this problem, I'd like to know the detail steps
to reproduce this problem, maybe there is some difference between your
steps and mine.

Thanks!
Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
Sunny - 11 Jun 2004 15:00 GMT
Hi Ying-Shen,

thanks for the replay.

I have resolved the problem. It seems that this is problem with VS.Net
2003. I have tried to restart it, but the problem persisted.

Then I fired regedit, and in HKEY_CLASSES_ROOT I found my assembly
exposed more than 20 times, some of the keys were directed to the non-
strong named (previous) assembly. Most probably this caused the problem.

I manually deleted all the keys and typelib entries, and after that
everything started to behave as it should be.

But in that regard, I have another question - how to unregister
assemblies, registered by the IDE, when I stop work with them. For now
IDE does not unregister them. If I start with new projects, etc., the
previous assembly registration are left in the registry, even I do not
need them any more - I.e. I have finished the project, I have installerr
package ready, and I really would like to have "clear" machine for the
next project.

Is there a way to tell IDE to unregister the stuff when I'm finished
with it?

Thanks
Sunny

> Hi Sunny,
>
[quoted text clipped - 20 lines]
> This mail should not be replied directly, please remove the word "online"
> before sending mail.
Ying-Shen Yu[MSFT] - 12 Jun 2004 08:58 GMT
Hi Sunny,

I also suspect the VS.NET is still using the non-strongnamed assemblies,
that's why I suggest you restarting the IDE, since it did some cache inside.
In your reply, you said you found 20+ exposed assemblies in registry, did
you specify Guid attribute for all of the exposed interfaces and classes?
If not, this might cause the problem, when register the assembly for COM
interop, the exporter will generate a Guid for COM visible interfaces and
classes automatically, since the auto generated Guid would be different in
next build time, exporter generated a new entry for the new GUID, this also
causes the exporter register a new type library for this compnent.

You need add Guid attribute for every COM visible interfaces and types. This
could reduce the entry count to one entry, as I know IDE doesn't not have an
option to unregister an assembly, but you can use
regasm /u <filename> /tlb:<tlbfilename>
to do this.
Does it resolve your problem?

Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
Sunny - 13 Jun 2004 15:21 GMT
Hi Ying-Shen,
I just can't belice that I missed something so obvious. Thanks for directing
me. I had to add some GUIDs :)

Thanks again
Sunny

> Hi Sunny,
>
[quoted text clipped - 27 lines]
> This mail should not be replied directly, please remove the word "online"
> before sending mail.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.