views:

98

answers:

1

I've taken a long look around and can't find any information on altering managed resources in assemblies (note that I'm already familar with Win32 resources and the APIs for altering those).

My application has resources that need to be updated by the end user and the application will be distributed as a single executable (so I can't just use satellite assemblies) .

I see a few possible workarounds, but they seem hackish:

The first is to use ILMerge: I'd create a new assembly in-memory which contains the new resources and use ILMerge to combine it with the original assembly to form the new program. The only downside is that resources cannot be updated or deleted.

The second is somewhat similar: There would be a .netmodule (emited from the C# compiler) which is ran against al.exe with the /embed switch to add the resources to form the new assembly. The downside being that none of the resources in the original assembly would be present.

I'm leaning towards the ILMerge option, but the terms on redistribution are ambiguous. The EULA makes no reference to redistribution rights (so I assume in this Negative Freedom society that it's permitted) yet the Microsoft Research page says redistribution is not permitted (but it's ambiguously worded, from what I can tell it might be referring to commercial redistribution, which wouldn't apply to me since this is a non-profit GPL project).

Thanks

+1  A: 

IMHO, I don't think it is a good idea to do it anyway. If this resources are actually user data, even if there is a "preinstalled" set of it, it does not belong to a embedded resource.

Are you're assemblies signed? You would have to resign them after changing, your private key is exposed and everyone can sign your application. So it's not worth to sign it and you have a security risk anyway.

Move your resources to an external file. You can still embed the "predefined" resources. The first time your application starts, you create the external file and copy the embedded resources to the external file. If the external file exists, you don't care about the embedded resources anymore.

Stefan Steinegger
Was my post of any use? If you think it was correct, please accept it as the correct answer.
Stefan Steinegger