Shared Resource Files in VS

That should capture your attention.  Anybody who has dealt with resource files across projects has been easily frustrated because there is no directly visible way to share resources across projects.

Well, surprise, there is.  There is a simple entry in the AssemblyInfo.cs that you can use to allow one project to access the internals of another.   The first step is to compile the project (FriendProject) you want to be able to see the internals of another project (ResourceProject).  Then use reflection to retrieve the public key of your FriendProject assembly (you do sign your assemblies don’t you).  Then using the entry below, fill in the FriendProject assembly name and its public key and away you go:

[assembly: InternalsVisibleTo("FriendProject, PublicKey=<key goes here>")]

Happy coding!

Advertisements

About JohnMarkHowell

I am a professional software developer with over 20 years of experience. I currently specialize in Microsoft technologies such as VS, TFS, C#, VB.Net, WCF, WPF, WW, etc.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s