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
  1. Home
  2. General Programming
  3. C#
  4. Conditional Compiler Symbols

Conditional Compiler Symbols

Scheduled Pinned Locked Moved C#
csharpwpfdebugginghelpquestion
5 Posts 3 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.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    I'm working on a WPF app that uses conditional compiler symbols all over the place. Then, some bright spark decided that the best way to test all of these was to create a new project for each one that references all the same classes/files/view/viewmodels, etc, but with a different compiler symbol in the debug settings. 1. The #IF symbols are ALL OVER THE CODE. It's a mess. 2. There are multiple project files that simply exist to compile different logic paths based on the symbol. This all seems like a hack. Anyone have a better approach?

    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

    OriginalGriffO 1 Reply Last reply
    0
    • K Kevin Marois

      I'm working on a WPF app that uses conditional compiler symbols all over the place. Then, some bright spark decided that the best way to test all of these was to create a new project for each one that references all the same classes/files/view/viewmodels, etc, but with a different compiler symbol in the debug settings. 1. The #IF symbols are ALL OVER THE CODE. It's a mess. 2. There are multiple project files that simply exist to compile different logic paths based on the symbol. This all seems like a hack. Anyone have a better approach?

      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      A more important question is : why does it need all these conditional compilations? To test them properly, you are going to need to have a new project for every possible combination, not just every symbol ... :~

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      K 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        A more important question is : why does it need all these conditional compilations? To test them properly, you are going to need to have a new project for every possible combination, not just every symbol ... :~

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #3

        That's my point. I think they were trying to create different versions of the app. There's got to be a better way

        If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

        T OriginalGriffO 2 Replies Last reply
        0
        • K Kevin Marois

          That's my point. I think they were trying to create different versions of the app. There's got to be a better way

          If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

          T Offline
          T Offline
          trønderen
          wrote on last edited by
          #4

          Disk space is cheap. RAM space is cheap. Simple IF-statements are cheap. OK, so changing the conditional compilation to run time tests could increase CPU load by half a percent. In extreme cases, the level of accusations of 'software bloat' may rise by as much as ten percent. Still, I think that is a better way.

          1 Reply Last reply
          0
          • K Kevin Marois

            That's my point. I think they were trying to create different versions of the app. There's got to be a better way

            If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #5

            Have a look at this question: Extend base project to dedicated customer projects[^] - it's another guy with a similar problem, and trying to work out a solution.

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            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