setting references with preprocessor directives

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob

    #1

    setting references with preprocessor directives

    Hi,
    Is it possible to change the references in a project based upon
    changing preprocesor symbols?

    Thanks,
    Bob
  • Peter Duniho

    #2
    Re: setting references with preprocessor directives

    On Sat, 04 Oct 2008 10:16:08 -0700, Bob <bshumsky06@yah oo.comwrote:
    Is it possible to change the references in a project based upon
    changing preprocesor symbols?
    I'm not sure. I don't think so, but haven't explored that fully. But,
    you should be able to use the configuration manager to create a build
    configuration where a particular preprocessor symbol is set appropriately
    and the associated library is referenced. Both the symbol and the
    reference would be dependent on the build configuration, rather than
    making the reference dependent on the symbol. But that may be close
    enough to what you want.

    Comment

    • Jon Skeet [C# MVP]

      #3
      Re: setting references with preprocessor directives

      Bob <bshumsky06@yah oo.comwrote:
      Is it possible to change the references in a project based upon
      changing preprocesor symbols?
      Not based on preprocessor symbols as far as I'm aware, but if you tweak
      the build file you can change references based on build configurations
      (which can also change the preprocessor symbols of course). We do this
      for MiscUtil. For instance, we've got sections like this:

      <ItemGroup Condition=" '$(Configuratio n)' != 'Release 2.0' ">
      <Reference Include="System .Core">
      <RequiredTarget Framework>3.5</RequiredTargetF ramework>
      </Reference>
      <Reference Include="System .Xml.Linq">
      <RequiredTarget Framework>3.5</RequiredTargetF ramework>
      </Reference>
      </ItemGroup>

      --
      Jon Skeet - <skeet@pobox.co m>
      Web site: http://www.pobox.com/~skeet
      Blog: http://www.msmvps.com/jon.skeet
      C# in Depth: http://csharpindepth.com

      Comment

      Working...