Groups | Blog | Home
all groups > dotnet general > november 2004 >

dotnet general : Resource Files


platinumbay
11/27/2004 11:45:24 PM
Is it possible to change embedded resource files at runtime, i.e. after the
Assembly has been compiled?

Thanks much

v-schang NO[at]SPAM online.microsoft.com
11/29/2004 6:03:02 AM
Hi Platinumbay,

Thanks for your posting. As for the embeded resource in a .net assembly,
they're part of the assembly's binary file so we can't manually modify them
without recompiling the whole assembly. If there is some resources that we
need to change frequently, it is recommend that we put them in a separate
assembly file which only contains resources so that we can only recompile
that assembly when changing some resources in it. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Richard Grimes [MVP]
1/1/2005 9:42:37 PM
[quoted text, click to view]

In addition, if the assembly that links the resource file is strong named it
means that you cannot change the external resource file. The reason is that
when you link a resource file a hash of the resource file is added to the
assembly's manifest. If the assembly is strong named then a hash is created
of the assembly (including all resources and hashes of external - linked -
resources) and this is signed with the private key. The signed hash and the
public key are stored in the assembly. When the assembly is loaded the
loader creates a hash, then it decrypted the signed hahs with the public key
and compares the two hashes. If the two are not the same then it means that
the assembly has changed and so the assembly is not loaded. Thus if you
change the external resource, it means that its hash is not the same, and so
the hash of the assembly is different. This is by design.

Richard
--
www.richardgrimes.com
my email evpuneqt@zicf.bet is encrypted with ROT13 (www.rot13.org)

v-schang NO[at]SPAM online.microsoft.com
1/4/2005 12:55:06 AM
Thanks for your inputs Richard,

The HASH you mentioned did highlight the concerns with the .net's
strong-named feature

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
AddThis Social Bookmark Button