Release build using Debug DLLs

G

Guest

Hi there

We are trying to build a C sharp solution in Visual Studio 2005 Professional.

We have a number of other assemblies, that do not form part of the solution.

Assemblies that do form part of the solution have been referenced using the
Projects tab in the Add Reference dialog.

Assemblies that do not form part of the solution have been added usingthe
Browse tab.

The problem is that when we do a Release build, it still references the
Debug build assemblies of the non solution projects, rather than the release
assemblies.

Is there any way of forcing the references to use Debug/Release assemblies
for the "browsed" assemblies as appropriate?

Thanks in advance

Hugh
 
K

Kevin Spencer

If the Assemblies do not form part of the solution, why are they part of the
solution? Reference the projects instead.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
 
B

bryan

When you used Browse to add the reference, you (probably) chose the Debug
location. Therefore, your project knows only about those files. It does not
know that there is a Release version available.

We do something like this for some common utility assemblies that are shared
across a number of solutions.

Our solution to this was to modify the project for those assemblies you wish
to include to copy the output to the PublicAssemblies directory under the
Visual Studio 8 (C:\Program Files\Microsoft Visual Studio
8\Common7\IDE\PublicAssemblies on my system). From that location,
solutions can establish references using the normal .NET tab of the add
reference dialog.

This allows you to choose which assemblies to link to by building the proper
version (or just copying them) when you want to change.
 
G

Guest

Thanks for th ereply. Kevin.

Perhaps I did not make myself as clear as I should. We do want to reference
the assemblies being used, but we didn't want to include the projects within
the solution (for various reasons). What we do want is too pick up the debug
versions of those referenced assembles (but not referenced by project) when
building teh solution in debug, and the release versions when building the
solution as Release.

We used to be able to do this under the pre- .Net VS by setting up the
libraries etc differently under each build configuration - there doesn't seem
to be that facility in VS2005.

We do not have the projects for some of the assemblies, just release and
debug builds.
 
G

Guest

Thanks for the prompt reply, Bryan.

This could work for us if the location you talk about can have both a
release and a debug build assembly in it - is this possible without changing
the asembly names?

Hugh
 
A

Andreas Mueller

Hugh said:
Thanks for the prompt reply, Bryan.

This could work for us if the location you talk about can have both a
release and a debug build assembly in it - is this possible without changing
the asembly names?

Hugh

Yes you can, but you have to edit the project file by hand. Open the
*.csproj files in a text editor and look for the reference to your DLL.
Here's an example if you would reference "nstl.dll":

<Reference Include="nstl, ....">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\nstl\bin\Debug\nstl.dll</HintPath>
</Reference>

Now simply replace the debug part of the hint path:

<HintPath>..\..\..\nstl\bin\$(Configuration)\nstl.dll</HintPath>

This will tell msbuild (the build engine under Visual Studio) to replace
"$(Configuration)" with "Debug" or "Release" according to the current
configuration

HTH,
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top