DesignMode

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

    #1

    DesignMode

    Is there any way for a program to autodetect when it is being run in Visual
    Studio vs being run from a compiled program that has been installed? I have
    tried DesignMode, but it always returns FALSE.

    Thanks, Bobbo


  • Cor Ligthert [MVP]

    #2
    Re: DesignMode

    Robert,

    There are statements for in DebugMode



    I hope this helps,

    Cor


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: DesignMode

      "Robert Liles" <rliles@midsout h.rr.com> schrieb:[color=blue]
      > Is there any way for a program to autodetect when it is being run in
      > Visual Studio vs being run from a compiled program that has been
      > installed? I have tried DesignMode, but it always returns FALSE.[/color]

      Maybe the following solutions fit your requirements:

      \\\
      #If DEBUG Then
      Console.WriteLi ne("Debug mode.")
      #Else
      Console.WriteLi ne("Release mode.")
      #End If
      ///

      Make sure that the option "Configurat ion settings" -> "Build" "Define DEBUG
      constant" in the project properties is checked.

      - and/or -

      You can check if a debugger is attached:
      'System.Diagnos tics.Debugger.I sAttached'.

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://classicvb.org/petition/>

      Comment

      • Robert S. Liles

        #4
        Re: DesignMode

        Thank you. I will give those a try.

        Bobbo
        _______________ _______________ _______________ _______________ ___

        "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
        news:uD7zg6DvFH A.2132@TK2MSFTN GP15.phx.gbl...[color=blue]
        > "Robert Liles" <rliles@midsout h.rr.com> schrieb:[color=green]
        >> Is there any way for a program to autodetect when it is being run in
        >> Visual Studio vs being run from a compiled program that has been
        >> installed? I have tried DesignMode, but it always returns FALSE.[/color]
        >
        > Maybe the following solutions fit your requirements:
        >
        > \\\
        > #If DEBUG Then
        > Console.WriteLi ne("Debug mode.")
        > #Else
        > Console.WriteLi ne("Release mode.")
        > #End If
        > ///
        >
        > Make sure that the option "Configurat ion settings" -> "Build" "Define
        > DEBUG
        > constant" in the project properties is checked.
        >
        > - and/or -
        >
        > You can check if a debugger is attached:
        > 'System.Diagnos tics.Debugger.I sAttached'.
        >
        > --
        > M S Herfried K. Wagner
        > M V P <URL:http://dotnet.mvps.org/>
        > V B <URL:http://classicvb.org/petition/>[/color]


        Comment

        • Robert S. Liles

          #5
          Re: DesignMode

          Thank you. I will give that a try.

          Bobbo

          _______________ _______________ _______________ _______________ ____________

          "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
          news:OLLtU0BvFH A.720@TK2MSFTNG P15.phx.gbl...[color=blue]
          > Robert,
          >
          > There are statements for in DebugMode
          >
          > http://groups.google.com/group/micro...3bf6a92?hl=en&
          >
          > I hope this helps,
          >
          > Cor
          >[/color]


          Comment

          • david

            #6
            Re: DesignMode

            On 2005-09-18, Robert Liles <rliles@midsout h.rr.com> wrote:[color=blue]
            > Is there any way for a program to autodetect when it is being run in Visual
            > Studio vs being run from a compiled program that has been installed? I have
            > tried DesignMode, but it always returns FALSE.[/color]

            To follow up on what others have said, you're going to have be more
            specific in your requirements. Do you need to detect...

            Am I running in VS in design mode, which is what the DesignMode property
            returns.

            Am I running under a debugger, which
            System.Diagnost ics.Debugger.Is Attached returns

            Am I compiled for Debug, for which "#if DEBUG" is useful

            Was I started from Visual Studio, which I'm not really sure how to
            detect.

            Was this program installed with the installer, which is probably most
            easily detected by setting a registry variable during installation.

            I'm not sure exactly what your requirements are, but all these are
            different. The other option that I usually use is to simply use
            something out of App.Config to determine mode. This would allow you
            to easily emulate installed environments even when debugging...

            Comment

            • Robert Liles

              #7
              Re: DesignMode

              Thank you. That gives me something to work with.

              Bobbo

              _______________ _______________ _______________ _______________ ___________

              "david" <david@woofix.l ocal.dom> wrote in message
              news:slrndir3qr .g4j.david@loca lhost.localdoma in...[color=blue]
              > On 2005-09-18, Robert Liles <rliles@midsout h.rr.com> wrote:[color=green]
              >> Is there any way for a program to autodetect when it is being run in
              >> Visual
              >> Studio vs being run from a compiled program that has been installed? I
              >> have
              >> tried DesignMode, but it always returns FALSE.[/color]
              >
              > To follow up on what others have said, you're going to have be more
              > specific in your requirements. Do you need to detect...
              >
              > Am I running in VS in design mode, which is what the DesignMode property
              > returns.
              >
              > Am I running under a debugger, which
              > System.Diagnost ics.Debugger.Is Attached returns
              >
              > Am I compiled for Debug, for which "#if DEBUG" is useful
              >
              > Was I started from Visual Studio, which I'm not really sure how to
              > detect.
              >
              > Was this program installed with the installer, which is probably most
              > easily detected by setting a registry variable during installation.
              >
              > I'm not sure exactly what your requirements are, but all these are
              > different. The other option that I usually use is to simply use
              > something out of App.Config to determine mode. This would allow you
              > to easily emulate installed environments even when debugging...
              >[/color]


              Comment

              Working...