shimming, signing and multiple assemblies

A

Alex

Hello,

I have a question:

I understand that I need a shim in order to strong-name my C# Word add-in.

Do I need to do anything special if the add-in consists of several assemblies?
For example: the main add-in DLL, a DLL with shared code and several third-party DLLs?

Thanks.


Best wishes,
Alex.
 
P

Peter Huang [MSFT]

Hi

I think there is no specially thing need to be done.
The Shim is just replace the job of mscoree.
Without Shim,
Word--->mscoree--->Managed Assembly----->Call other assembly

With Shim
Word--->Shim---->Managed Assembly------>Call other assembly

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Alex

Hello Peter,

"Peter Huang" said:
Hi

I think there is no specially thing need to be done.
The Shim is just replace the job of mscoree.
Without Shim,
Word--->mscoree--->Managed Assembly----->Call other assembly

With Shim
Word--->Shim---->Managed Assembly------>Call other assembly

If you still have any concern, please feel free to post here.

Do I need to strong name all the DLLs then?


Best wishes,
Alex.
 
P

Peter Huang [MSFT]

Hi

I recommend you strongname all the other assemblies, because Types in
strong-named assemblies can be called by partially trusted code only when
the assemblies have been marked with the AllowPartiallyTrustedCallers
attribute (APTCA).

.NET Framework Assemblies and the AllowPartiallyTrustedCallers Attribute
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/ht
ml/aptcatypes.asp

That is to say, assume there is a type defined in COMAddin
assembly(strongnamed), and the other assembly, which is not strongnamed
wants to call the type, you must marked the COMAddin assembly with APTCA,
which is not recommended.

But if the other assembly will not call the strongname one, you may just
leave them out.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Alex

Hello Peter,

"Peter Huang" said:
Hi

I recommend you strongname all the other assemblies, because Types in
strong-named assemblies can be called by partially trusted code only when
the assemblies have been marked with the AllowPartiallyTrustedCallers
attribute (APTCA).

NET Framework Assemblies and the AllowPartiallyTrustedCallers Attribute
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/ht
ml/aptcatypes.asp

That is to say, assume there is a type defined in COMAddin
assembly(strongnamed), and the other assembly, which is not strongnamed
wants to call the type, you must marked the COMAddin assembly with APTCA,
which is not recommended.

But if the other assembly will not call the strongname one, you may just
leave them out.

So, let's see if I understand correctly.

Say I have these assemblies:
Addin.DLL - the COM add-in
Logger.DLL - public logging classes
Utilities.DLL - common public utility classes

Where:
Addin.DLL uses classes from Logger.DLL and Utilities.DLL
Logger.DLL uses classes from Utilities.DLL

So, I have to create a shim for Addin.DLL and sign it with a strong name
but Logger.DLL and Utilities.DLL can remain unsigned?

Best wishes,
Alex.
 
P

Peter Huang [MSFT]

Hi Alex,

Thanks for your quickly reply!
Firstly I appologize that I miss something.
Based on my further Test, if we have a strongnamed assembly A, and a common
assembly B, A will call B, the B also needed to be strongnamed.

Here is a KB article describe the problem as below.
PRB: "Assembly Generation Failed" Error Message When You Try to Build a
Managed DLL Without a Strong Name (313666)
http://support.microsoft.com/default.aspx?scid=KB;EN-US;313666

So for your scenario, I think you need to sign all the other assemblies
referenced by the Strongnamed Comaddin.

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Top