Groups | Blog | Home
all groups > visual studio .net ide > october 2006 >

visual studio .net ide : No Support for Conditional References


martin.douglas NO[at]SPAM gmail.com
10/21/2006 5:48:50 PM
I am looking to be able to use the Visual Studio 2005 IDE to manage ALL
of my configurations. It is easy to create custom configurations
throught he configuration manager and then to write code that is
sensitive to the active configuation. That is easy except when it
comes to references.

What if I have some code that is not included under the current
configuration? In my case, it is excluded through #if statements. So
the source is gone, but I am forced to carry heavy payloads in the
final output directory due to the fact that I cannot exclude DLL's no
longer applicable in the references section of the project.

Why is there no simple support for this? For example... why can't the
properties of a referenced assembly simply contain a list of the
configurations to which they apply? A simple default value of "Applies
to all configurations" would make sense.

So not wanting to write build scripts, the only thing I have at my
disposal is to ask developers to remove the reference before compiling
under a given configuration and then remember to put them back when
they are done. This is extremely sloppy.

Does anyone know of any other built-in functionality in the IDE?

Thanks in advance.
Carlos J. Quintero [VB MVP]
10/23/2006 2:04:39 PM
Hi,

There is no built-in support for configuration-based references, surely
because all configurations normally need the same references.

You could automate adding/removing references using a macro or add-in. Let
us know if you want to follow that route.

If you are only worried about the DLLs copied to the output folder, they can
be removed with a post-build action or macro.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com


<martin.douglas@gmail.com> escribió en el mensaje
news:1161478130.468021.88540@m73g2000cwd.googlegroups.com...
[quoted text, click to view]

martin.douglas NO[at]SPAM gmail.com
10/24/2006 8:16:33 PM
A macro approach would suffice. I need to get the entries out of the
project file in essence so that ClickOnce will not detect the DLL's as
dependencies and try to deploy them.

Thanks
Carlos J. Quintero [VB MVP]
10/25/2006 12:00:00 AM
See my article:

HOWTO: Getting information specific to VB.NET and C# projects from an add-in
or macro.
http://www.mztools.com/resources_vsnet_addins.htm

to learn how to access programatically the references of a project. You can
remove a reference with Reference.Remove and add them later with
References.AddXXX(...).

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com



<martin.douglas@gmail.com> escribió en el mensaje
news:1161746193.656634.83400@f16g2000cwb.googlegroups.com...
[quoted text, click to view]

AddThis Social Bookmark Button