Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. .NET version dependent compilation

.NET version dependent compilation

Scheduled Pinned Locked Moved C#
csharpquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brain2cpu
    wrote on last edited by
    #1

    is there something like: #if theCompilerVersionIs1.0 using Microsoft.Data.Odbc; #else using System.Data.Odbc; ?? I have VS2002 and have to command line compile for 1.1 and it would be great not to change my code for this.

    H 1 Reply Last reply
    0
    • B brain2cpu

      is there something like: #if theCompilerVersionIs1.0 using Microsoft.Data.Odbc; #else using System.Data.Odbc; ?? I have VS2002 and have to command line compile for 1.1 and it would be great not to change my code for this.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      There is preproc conditions supported by the C# compiler, yes, but there is no such definitions provided by the compiler that are documented, so you'll have to pass them yourself using /d:SYMBOL or configuring additional symbols in your VS.NET project (go to project properties, expand Configuration Properties, click on Build, and add symbols to the Conditional Compilation Constants at the top). An example follows:

      #if CSC10
      using Microsoft.Data.Odbc;
      #else
      using System.Data.Odbc;
      #endif

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups