.NET1.1 ILMerge.exe tool doesn`t keep ReflectionPermissionAttribute

Hello all,

first of all, sorry for my english.

As to my question, I`m having troubles with ILMerge utility (my .NET Framework is v1.1.4322) which I use to create a single SharePoint WebPart assembly from two separate assemblies:

ProjectDescWebPart.dll - WebPart assembly

BAUtil.dll - my general purpose library of auxiliary components which I use everywhere in my projects and which i do need to use in ProjectDescWebPart.dll too.

In order to create WebPart deployable .cab package I need to make a single assembly from them (ProjectDescWebPartPkg.dll) which I would be later able to declare in the WebPart manifest file (unfortunately, it is impossible to declare two separate assemblies in the manifest to be placed into c:\Inetpub\wwwroot\bin folder - otherwise there wouldn`t be any problems), so i use the following ilmerge call:

ilmerge /out:ProjectDescWebPartPkg.dll /copyattrs /allowMultiple ProjectDescWebPart.dll BAUtil.dll

It works almost fine - I`m getting valid ProjectDescWebPartPkg.dll file, which is correctly included into .cab and deployed on SharePoint Web Site (and it really works there).

The only problem is that I need to use:

[assembly: ReflectionPermission(SecurityAction.RequestMinimum, MemberAccess=true, TypeInformation=true)]

attribute in the ProjectDescWebPart.dll assembly, and this attribute is not getting copied to the resulting ProjectDescWebPartPkg.dll file (it gets clear if we inspect two these files with permview utility - the first one has this permission, while the second not).

All other attributes except this one are getting correctly migrated from the ProjectDescWebPart.dll and BAUtil.dll to the final ProjectDescWebPartPkg.dll, only this single attribute is missing.

Does anybody have any idea how to work around this issue

Thanx in advance.



Answer this question

.NET1.1 ILMerge.exe tool doesn`t keep ReflectionPermissionAttribute

  • SHIYAS

    Might you be able to provide the complete permview output (without /decl switch) for both of the pre-merge DLLs
  • RSDuren

    Here it is:

    permview ProjectDescWebPart.dll


    Microsoft (R) .NET Framework Permission Request Viewer. Version 1.1.4322.573
    Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

    minimal permission set:
    <PermissionSet class="System.Security.PermissionSet"
    version="1">
    <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Flags="TypeInformation, MemberAccess"/>
    </PermissionSet>

    optional permission set:
    Not specified

    refused permission set:
    Not specified

    permview BAUtil.dll

    Microsoft (R) .NET Framework Permission Request Viewer. Version 1.1.4322.573
    Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

    minimal permission set:
    <PermissionSet class="System.Security.PermissionSet"
    version="1">
    <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Flags="TypeInformation, MemberAccess"/>
    </PermissionSet>

    optional permission set:
    Not specified

    refused permission set:
    Not specified

    (it`s not an error, the same attribute is declared in both ProjectDescWebPart and BAUtil - actually, I need that permission for some BAUtil classes to work well)

    permview ProjectDescWebPartPkg.dll

    Microsoft (R) .NET Framework Permission Request Viewer. Version 1.1.4322.573
    Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

    minimal permission set:
    Not specified

    optional permission set:
    Not specified

    refused permission set:
    Not specified

    Best regards,

    Andrey Arkhipov.


  • Jon Jacobs

    It looks like ILMerge might be using the same logic as System.Assembly.GetCustomAttributes to detect assembly-level attributes. Unfortunately, this excludes permission attributes.

    It is possible to detect permission attributes using other means (as permview does), and ILMerge probably ought to do so. Your best bet would probably be to report the issue to the ILMerge author, as suggested in the "Overview" section of the ILMerge download page at http://www.microsoft.com/downloads/details.aspx FamilyID=22914587-b4ad-4eae-87cf-b14ae6a939b0.


  • .NET1.1 ILMerge.exe tool doesn`t keep ReflectionPermissionAttribute