Visual Studio: Adding DLL References Whose Version Changes Frequently

Let’s assume you have a C# project in Visual Studio. In that project, you reference an assembly (DLL) created by another of your projects. Because both projects are in active development, the version number of the referenced assembly changes frequently.

There is one easy way to solve this:

Add a reference to the project by clicking “Add Reference…” and choosing from the tab “Projects”. But this has two downsides:

  1. The target project needs to be in the same solution
  2. The target project had better be a C# project, too. If it is a C++ project, for example, you will not be able to compile the (soure/referencing) project in Blend.

But there is an alternative:

Add a reference to the compiled DLL by clicking “Add Reference…” and choosing from the tab “Browse”. This seems to work fine initially, until the target DLL is updated and its version number changes. Then all hell breaks loose and there is no way to fix this - from the GUI.

But under the covers everything is pretty simple. When you add a DLL reference the IDE creates an entry like the following in the project file (*.CSPROJ):

<reference include="SomeTargetDLL, Version=1.0.0.123, Culture=neutral, processorArchitecture=x86" />

As is pretty obvious once viewed in code: the reference contains a version definition tag. Remove that, and you are good. In above example I simplified the line to:

<reference include="SomeTargetDLL" />

Comments

Related Posts

Visual Studio: Fixing Broken $(WindowsSdkDir) Variable

If you get weird errors in Visual Studio that basically state files like Windows.h cannot be found, the reason may be a missing or incorrect WindowsSdkDir variable. In my case, working with Visual Studio 2008 SP1 (32 bit) on Windows 7 x64 (64 bit) everything was fine until I installed the Windows 7 SDK. After that, no SDK files could be found any more and nothing would compile. Uninstalling the SDK (which I did not really need anyway - I had installed it only to get at XPerf) did not help. After some research, I found out that the Visual Studio internal variable WindowsSdkDir (which is not an environment variable) was missing from the registry. After adding the following, everything worked like a charm again:
Software development

How to Enable Drag and Drop for an Elevated MFC Application on Windows

Finding good information on how to enable drag and drop for MFC applications is hard enough (why?). But just when you think you should have it working, you hit a very solid wall: UIPI (User Interface Privilege Isolation, a variant of UAC, User Account Control). Because of “security” reasons, UIPI disables drag and drop from medium integrity processes (Explorer) to high integrity (aka elevated) processes by filtering out most window messages, including those required for drag and drop. In essence drag and drop from Explorer to your elevated application does not work.
Software development

Latest Posts