Resource Files

  • Thread starter Thread starter platinumbay
  • Start date Start date
P

platinumbay

Is it possible to change embedded resource files at runtime, i.e. after the
Assembly has been compiled?

Thanks much
 
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.)
 
Steven said:
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.

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
 
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.)
 
Back
Top