control references with preprocessor directives

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

    control references with preprocessor directives

    Hi,
    Is it possible to change the references in a project by using
    preprocessor directives?

    Thanks,
    Bob
  • Peter Duniho

    #2
    Re: control references with preprocessor directives

    On Thu, 09 Oct 2008 10:50:06 -0700, Bob <bshumsky06@yah oo.comwrote:
    Is it possible to change the references in a project by using
    preprocessor directives?
    In what way is this question different from the last time you asked it?

    Comment

    • Bob

      #3
      Re: control references with preprocessor directives

      On Oct 9, 1:06 pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
      wrote:
      On Thu, 09 Oct 2008 10:50:06 -0700, Bob <bshumsk...@yah oo.comwrote:
      Is it possible to change the references in a project by using
      preprocessor directives?
      >
      In what way is this question different from the last time you asked it?
      It is not at all different. I have no idea where that thread is, I
      thought that google lost it. When I look under my profile there is
      nothing and when I search for preprocessor directives I get nothing.
      If you could point me to the thread I'm sure it would answer the
      question.

      Thanks,
      Bob

      Comment

      • Duggi

        #4
        Re: control references with preprocessor directives

        On Oct 9, 10:50 am, Bob <bshumsk...@yah oo.comwrote:
        Hi,
        Is it possible to change the references in a project by using
        preprocessor directives?
        >
        Thanks,
        Bob
        I think you can do something like the below for referencing the
        namespace.

        #if SYMBOL
        using System.Collecti ons;
        #endif

        however referencing dll is a compile time option not included in the
        code.

        It would be your choice to include a perticular dll in /r option or
        not.

        -Cnu

        Comment

        • Bob

          #5
          Re: control references with preprocessor directives

          On Oct 9, 1:22 pm, Duggi <DuggiSrinivasa ...@gmail.comwr ote:
          On Oct 9, 10:50 am, Bob <bshumsk...@yah oo.comwrote:
          >
          Hi,
          Is it possible to change the references in a project by using
          preprocessor directives?
          >
          Thanks,
          Bob
          >
          I think you can do something like the below for referencing the
          namespace.
          >
          #if SYMBOL
          using System.Collecti ons;
          #endif
          >
          however referencing dll is a compile time option not included in the
          code.
          >
          It would be your choice to include a perticular dll in /r option or
          not.
          >
          -Cnu
          Thanks for your response. The problem I am having is with different
          versions of Excel that have same name so I want to be able to have one
          build for release 11 and another for release 12. They have the same
          "using" name so the first option won't work. I don't follow your
          second suggestion.

          Comment

          • Peter Duniho

            #6
            Re: control references with preprocessor directives

            On Thu, 09 Oct 2008 11:14:56 -0700, Bob <bshumsky06@yah oo.comwrote:
            >In what way is this question different from the last time you asked it?
            >
            It is not at all different. I have no idea where that thread is, I
            thought that google lost it. When I look under my profile there is
            nothing and when I search for preprocessor directives I get nothing.
            If you could point me to the thread I'm sure it would answer the
            question.
            I have no idea why the thread doesn't appear on Google. I'd say they
            probably did lose it. The thread is on my own news server though and
            probably on other more-reliable ones. You might try an alternate news
            server; Google is definitely not the most reliable around.

            In the meantime, see below for the two replies to your original question.

            Pete



            On Sat, 04 Oct 2008 10:44:42 -0700, Peter Duniho
            <NpOeStPeAdM@nn owslpianmk.comw rote:
            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.


            On Sat, 04 Oct 2008 23:26:42 -0700, Jon Skeet [C# MVP] <skeet@pobox.co m>
            wrote:
            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>
            >

            Comment

            • Bob

              #7
              Re: control references with preprocessor directives

              On Oct 9, 10:00 pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
              wrote:
              On Thu, 09 Oct 2008 11:14:56 -0700, Bob <bshumsk...@yah oo.comwrote:
              In what way is this question different from the last time you asked it?
              >
              It is not at all different.  I have no idea where that thread is, I
              thought that google lost it.  When I look under my profile there is
              nothing and when I search for preprocessor directives I get nothing.
              If you could point me to the thread I'm sure it would answer the
              question.
              >
              I have no idea why the thread doesn't appear on Google.  I'd say they  
              probably did lose it.  The thread is on my own news server though and  
              probably on other more-reliable ones.  You might try an alternate news  
              server; Google is definitely not the most reliable around.
              >
              In the meantime, see below for the two replies to your original question.
              >
              Pete
              >
              On Sat, 04 Oct 2008 10:44:42 -0700, Peter Duniho  
              >
              <NpOeStPe...@nn owslpianmk.comw rote:
              On Sat, 04 Oct 2008 10:16:08 -0700, Bob <bshumsk...@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.
              >
              On Sat, 04 Oct 2008 23:26:42 -0700, Jon Skeet [C# MVP] <sk...@pobox.co m 
              wrote:
              >
              Bob <bshumsk...@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>
              Thanks very much! What is a better news server?

              Comment

              • Bob

                #8
                Re: control references with preprocessor directives

                On Oct 10, 7:51 am, Bob <bshumsk...@yah oo.comwrote:
                On Oct 9, 10:00 pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
                wrote:
                >
                >
                >
                On Thu, 09 Oct 2008 11:14:56 -0700, Bob <bshumsk...@yah oo.comwrote:
                >In what way is this question different from the last time you asked it?
                >
                It is not at all different.  I have no idea where that thread is, I
                thought that google lost it.  When I look under my profile there is
                nothing and when I search for preprocessor directives I get nothing.
                If you could point me to the thread I'm sure it would answer the
                question.
                >
                I have no idea why the thread doesn't appear on Google.  I'd say they 
                probably did lose it.  The thread is on my own news server though and 
                probably on other more-reliable ones.  You might try an alternate news  
                server; Google is definitely not the most reliable around.
                >
                In the meantime, see below for the two replies to your original question.
                >
                Pete
                >
                On Sat, 04 Oct 2008 10:44:42 -0700, Peter Duniho  
                >
                <NpOeStPe...@nn owslpianmk.comw rote:
                On Sat, 04 Oct 2008 10:16:08 -0700, Bob <bshumsk...@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.
                >
                On Sat, 04 Oct 2008 23:26:42 -0700, Jon Skeet [C# MVP] <sk...@pobox.co m 
                wrote:
                >
                Bob <bshumsk...@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>
                >
                Thanks very much!  What is a better news server?
                Thanks. This is a dumb question but where is the build file in a
                Visual Studio project?

                Comment

                • Jon Skeet [C# MVP]

                  #9
                  Re: control references with preprocessor directives

                  Bob <bshumsky06@yah oo.comwrote:

                  <snip>
                  Thanks very much!  What is a better news server?
                  Thanks. This is a dumb question but where is the build file in a
                  Visual Studio project?
                  Look for a file called .csproj.

                  --
                  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

                  • Peter Duniho

                    #10
                    Re: control references with preprocessor directives

                    On Fri, 10 Oct 2008 05:51:55 -0700, Bob <bshumsky06@yah oo.comwrote:
                    Thanks very much! What is a better news server?
                    Difficult to say for sure, because it depends on what you have access to.
                    But there's a free server at http://aioe.org/ For this particular
                    newsgroup, you can use Microsoft's public server, which can be reached
                    with the name msnews.microsof t.com or news.microsoft. com. There are paid
                    services, including Supernews (not great, but better than Google), and the
                    one that my own ISP uses, Giganews (that is, I don't pay them directly,
                    but my ISP outsources to them so that's what I wind up using anyway).

                    If you only need access to the Microsoft "microsoft.publ ic..." hierarchy,
                    then I'd say Microsoft's server would be the best bet. You appear to be
                    using Vista, so as a news reader you might use the Windows Mail program
                    (which used to be Outlook Express). Or, since you're a Firefox user, you
                    might prefer Thunderbird. Other alternatives include 40tude, Forté Agent,
                    and Opera.

                    Pete

                    Comment

                    Working...