Error when compiling .resx file – Attempt to load a program with an invalid structure

I have seen this before and fixed it, but ran into it again today and could not remember what is was. When compiling a WinForms application in Visual Studio 2010, I got an error message stating “Kan bestand of assembly (…) of een van de afhankelijkheden hiervan niet laden. Poging om een programma te laden met een onjuiste indeling. ” (Roughly translated, “Can not load assembly (…) or one of its dependencies. Attempt to load a program with an invalid structure.”).

When double-clicking the error, it points to a base64-encoded piece of a resx-file, in this case an image stream for an image list.

This is a bug in Visual Studio 2010 that has not yet been fixed. See here on Microsoft Connect.

The workaround suggested by Pellet21 works for me in the mean time. I’ll copy it here to save myself from Googling for it next time:

Workaround
1.    Open Form in Designer and make needed GUI changes. Close designer and save
2.    Compile project and receive RESX compile error (only forms with Imagelist should have this problem)
3.    Double-click resx compile error to open resx file.
4.    Scroll to top of imagestream.
5.    Edit the top line of the Image stream:
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
TO
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
6.    Close and save resx file and recompile.
**NOTE: the only difference are the characters at end “j00LjAuMC4w’ to “j0yLjAuMC4w”

This needs to be done EVERY TIME you open the form in Designer mode.

Advertenties

Issuing SVN commands from UltraEdit

Now I am getting used to having VisualSVN around when I am editing from Visual Studio, or the Subversion integration Delphi has (although that is broken since I upgraded to svn 1.7), I sometimes miss it when editing other kinds of files from my favorite UltraEdit text editor. While googling around to see if there was some kind of plugin available (apart from upgrading to the full blown UEStudio, which I don’t need), I found this blog post from Rob. He describes how to use the Tools Configuration menu to issue svn commands. Nice! But it gets even better if you scroll down to the comments where Daniel explains another syntax that fires up the TortoiseSVN dialogs instead of the svn command line. I like that even better!

I’ve quickly configured my UltraEdit installation likewise. Thanks to both Rob and Daniel. For my own reference if I later forget how I did this, here’s a copy of Daniels description of his setup:

TortoiseProc.exe /command:commit /path:”%f”
TortoiseProc.exe /command:update /path:”%f”
TortoiseProc.exe /command:diff /path:”%f”
TortoiseProc.exe /command:log /path:”%f”

I’ve also produced nice 16×16 .bmp icons via a simple screen capture of the context menu icons Tortoise uses for these command, to use as the command icons in my UltraEdit toolbar.

Since each of these displays a dialog I’ve selectedd Program Type “Windows Program” (although I don’t think it matters), and unselected Save Active File for the SVN Show Log command (not a requirement to show the SVN log). None of these have the Capture Output option selected.