Removing Assembly Signature Breaks Embedded RESX Data

0

Working on a large Winforms project with many custom controls containing custom properties. The C# project with the controls is strongly-named. I have been unable to remove the signature or change the assembly, class, or namespace in any way without breaking all consuming forms.

Sample to reproduce:

  1. Create Strong-named Class library with one component containing a nested property.

[TypeConverter(typeof(ExpandableObjectConverter)), Serializable] public class InnerDetails { public int DogYears { get; set; }; }
public partial class Component1 : Control { public Component1() { InitializeComponent(); } public InnerDetails InnerDetails { get; set; } = new InnerDetails(); }

  1. Reference Class library by another WinForms assembly.

  2. Drag/drop Component1 onto a form

    • Form1.resx now has an entry representing Inner Details AAEAAAD/////AQAAAAAAAAAMAgAAAFBDbGFzc0xpYnJhcnkxLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1 cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49ZDFjMmE5YmVlMThkOTZlNwUBAAAAGkNsYXNzTGlicmFy eTEuSW5uZXJEZXRhaWxzAQAAABk8RG9nWWVhcnM+a19fQmFja2luZ0ZpZWxkAAgCAAAABgAAAAs=

At this point all builds and works well

Now remove signing from Class Library, or modify any part of the strong name (assembly name, class, namespace...)

  • Build breaks:

error MSB3103: Invalid Resx file. Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d1c2a9bee18d96e7' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) Line 126, position 5.

Manually deleting RESX nodes generates a different error and seems to risk losing configuration data.

There are several dozen forms with this, each containing 4-12 nodes.

I am now experimenting with Base64-decoding but would appreciate any better alternatives.

c#
winforms
strongname
asked on Stack Overflow May 15, 2018 by John Arlen

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0