views:

21

answers:

1

I've added a registry key like HKLM\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyFolder with a folder that has my assemblies in it, and I can see those assemblies from Visual Studio when viewing the "Add Reference" dialog.

My question is how can I tell Visual Studio that it should add a vague reference instead of a very specific one?

For example, in my .csproj file, I see <Reference Include="System.Xml" /> without a version, culture or public key token. But when I add my own reference, it specifies all of those things, meaning my build will break if I upgrade an assembly.

Alternatively, is there a way to make Visual Studio set the SpecificVersion metadata to False? This would accomplish the same goal.

A: 

I believe this is by design. The IDE does not allow for your assemblies to be added without a version number. This makes sense in the case that you might be developing against a particular version of components.

If your code checks the version number, you must explicitly choose the new version as the author of a client assembly. Otherwise you could be surprised by breaking changes introduced in the referenced assembly.

Edit This article on Partial Assembly References at MSDN link text is probably the way you want to get around this problem. I found this in another SO post link text. Note: In this case, you will use Assembly.Load, which will look in the application's directory.

Blanthor
Partial references in the csproj file are resolved at build time, so whether I specify version, culture, etc, or not, my assembly will have a reference that includes all of those things as long as the build finds a matching assembly.
Chris Eldredge