PC Review


Reply
Thread Tools Rate Thread

control references with preprocessor directives

 
 
Bob
Guest
Posts: n/a
 
      9th Oct 2008
Hi,
Is it possible to change the references in a project by using
preprocessor directives?

Thanks,
Bob
 
Reply With Quote
 
 
 
 
Bob
Guest
Posts: n/a
 
      9th Oct 2008
On Oct 9, 1:06*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
> On Thu, 09 Oct 2008 10:50:06 -0700, Bob <bshumsk...@yahoo.com> wrote:
> > 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
 
Reply With Quote
 
Duggi
Guest
Posts: n/a
 
      9th Oct 2008
On Oct 9, 10:50*am, Bob <bshumsk...@yahoo.com> wrote:
> 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.Collections;
#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
 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      9th Oct 2008
On Oct 9, 1:22*pm, Duggi <DuggiSrinivasa...@gmail.com> wrote:
> On Oct 9, 10:50*am, Bob <bshumsk...@yahoo.com> wrote:
>
> > 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.Collections;
> #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.
 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      10th Oct 2008
On Oct 9, 10:00*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
> On Thu, 09 Oct 2008 11:14:56 -0700, Bob <bshumsk...@yahoo.com> wrote:
> >> 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...@nnowslpianmk.com> wrote:
> > On Sat, 04 Oct 2008 10:16:08 -0700, Bob <bshumsk...@yahoo.com> wrote:

>
> >> 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.com> *
> wrote:
>
> > Bob <bshumsk...@yahoo.com> wrote:
> >> 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=" '$(Configuration)' != 'Release 2.0' ">
> > * * <Reference Include="System.Core">
> > * * * <RequiredTargetFramework>3.5</RequiredTargetFramework>
> > * * </Reference>
> > * * <Reference Include="System.Xml.Linq">
> > * * * <RequiredTargetFramework>3.5</RequiredTargetFramework>
> > * * </Reference>
> > * </ItemGroup>


Thanks very much! What is a better news server?
 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      10th Oct 2008
On Oct 10, 7:51*am, Bob <bshumsk...@yahoo.com> wrote:
> On Oct 9, 10:00*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
> wrote:
>
>
>
> > On Thu, 09 Oct 2008 11:14:56 -0700, Bob <bshumsk...@yahoo.com> wrote:
> > >> 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...@nnowslpianmk.com> wrote:
> > > On Sat, 04 Oct 2008 10:16:08 -0700, Bob <bshumsk...@yahoo.com> wrote:

>
> > >> 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.com> *
> > wrote:

>
> > > Bob <bshumsk...@yahoo.com> wrote:
> > >> 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=" '$(Configuration)' != 'Release 2.0' ">
> > > * * <Reference Include="System.Core">
> > > * * * <RequiredTargetFramework>3.5</RequiredTargetFramework>
> > > * * </Reference>
> > > * * <Reference Include="System.Xml.Linq">
> > > * * * <RequiredTargetFramework>3.5</RequiredTargetFramework>
> > > * * </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?
 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      10th Oct 2008
Bob <(E-Mail Removed)> wrote:

<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 - <(E-Mail Removed)>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.Net missing preprocessor directives? PJ6 Microsoft VB .NET 2 6th Mar 2009 02:25 PM
setting references with preprocessor directives Bob Microsoft C# .NET 1 5th Oct 2008 07:26 AM
Preprocessor directives in codebehind file Theon Greyjoy Microsoft ASP .NET 1 6th Oct 2006 09:17 PM
Preprocessor directives must appear as the first non-whitespace character on a line erin.sebastian@cowaninsurancegroup.com Microsoft Dot NET Framework 3 14th Feb 2006 03:14 AM
CS1040: Preprocessor directives must appear as the first non-white =?Utf-8?B?V0I=?= Microsoft Dot NET Framework 2 17th May 2005 04:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:50 AM.