none
my application deploy path/location RRS feed

  • Question

  • Hi, I need to know where is my application deploy

    if is Local environment or in Network environment or if is Production environment to show a message what kind of deploy running the application.

    somebody can help me I am working in wpf vb.net with prism 7

    thanks

    sincerely

    Tuesday, October 8, 2019 9:55 PM

All replies

  • Hello,

    Here we check if the path is network or not

    Public Shared Function IsNetworkPath(path As String) As Boolean
        If path.StartsWith("/") OrElse path.StartsWith("\") Then
            Return True ' is a UNC path
        End If
        Dim rootPath = System.IO.Path.GetPathRoot(path) ' get drive's letter
        Dim driveInfo = New DriveInfo(rootPath) ' get info about the drive
        Return driveInfo.DriveType = DriveType.Network ' return true if a network drive
    End Function
    
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
        If IsNetworkPath(path) Then
            ' network
        Else
            ' local
        End If
    End Sub


    In regards to production environment, what are the conditions you see as a production environment as there can be many conditions to pick from.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange



    Tuesday, October 8, 2019 11:21 PM
    Moderator
  • Thanks is work but now the client explain me them have  a server sql in the app.config is the conexction string for database, so I add this inn the app.config

     <applicationSettings>
        <MySettings>
          <setting name="DEVELOP" serializeAs="String">
            <value>conexion1</value>
          </setting>
          <setting name="STAGING" serializeAs="String">
            <value>dconexion2</value>
          </setting>
          <setting name="PRODUCTIONDB" serializeAs="String">
            <value>decide</value>
          </setting>
        </MySettings>
      </applicationSettings>

    Just I tried to read this file to compare with the connectionstring, to see with conexion is working if is Develop,production or local.

    anyhelp plsss.

    thanks

    Wednesday, October 9, 2019 8:34 PM
  • Thanks is work but now the client explain me them have  a server sql in the app.config is the conexction string for database, so I add this inn the app.config

     <applicationSettings>
        <MySettings>
          <setting name="DEVELOP" serializeAs="String">
            <value>conexion1</value>
          </setting>
          <setting name="STAGING" serializeAs="String">
            <value>dconexion2</value>
          </setting>
          <setting name="PRODUCTIONDB" serializeAs="String">
            <value>decide</value>
          </setting>
        </MySettings>
      </applicationSettings>

    Just I tried to read this file to compare with the connectionstring, to see with conexion is working if is Develop,production or local.

    anyhelp plsss.

    thanks

    If your initial question has been answered mark any replies that answered it as answered. Next start a new post for the new question as we do one topic/question per post.



    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, October 9, 2019 8:57 PM
    Moderator