Software Geek

March 26, 2008

Versioning/Deploying Unmanaged Files

Filed under: Software

Also see: Important changes to the BASE element for IE 7

Also see: Blogging and Newspapers, a Lesson in How Not to Brand and Market

Also see: Chris Sells

An unmanaged dll can be wrapped in a managed assembly by adding it as a file of a multi-module assembly. Then, it can be deployed and versioned in the same way as managed assemblies. (So, that assembly could contain nothing but metadata and unmanaged code - no managed code, if you prefer. It can also contain multiple unmanaged files in the same assembly.)

If your compiler does not support this directly, you can get this to work by adding that file as a linked managed resource. For example, see Visual Studio’s /linkresource option (if using it for command line compiling).

This is useful in the case where DllImport() is used to access a function in that file. That call should be updated with the new assembly’s info. For example, in the place of “unmanagedfile.dll”, change it to include the display name like this: “unmanagedfile.dll, managedassembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″.

If that unmanaged file needs to be loaded by LoadLibrary() outside of DllImport(), however, it will need to follow the rules of LoadLibrary(), like the usual unmanaged file use outside the CLR. (See Junfeng’s blog for an extra tip regarding that when using v2.)


http://blogs.msdn.com/suzcook/archive/2004/10/28/versioning-deploying-unmanaged-files.aspx

Comments »

The URI to TrackBack this entry is: http://annil12.blogsome.com/2008/03/26/versioningdeploying-unmanaged-files-2/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Jay of onefinejay.com