Click Once Data Directory

 

Click Once Data Directory


Source: http://blogs.msdn.com/b/winformsue/archive/2006/04/26/584559.aspx

 

Under ClickOnce, the data directory is a long, garbled path, such as C:\Documents and Settings\username\Local Settings\Apps\2.0\Data\DXQV72TZ.3GR\EERQ26OC.Y91\test..tion_9d0ab10300fca701_0001.0000_edbfed2eeae795d5\Data. I can find the value of this path (deliberately obscured to foil easy discovery of my app's data) by callingApplication.UserAppDataPath.

However, when I'm debugging my app in Visual Studio, the data directory path is set to C:\Documents and Settings\username\Application Data\Publisher Name\App Name\Version Number.

 

 Private Function GetDataDirectory() As String

        Dim _ExeDir As String

        Dim _PathStr As String

        If (ApplicationDeployment.IsNetworkDeployed) Then

            _PathStr = Application.UserAppDataPa№as arth & "\images"

        Else

            ' Check if it's in the exe directory, or in a debug folder dir.

            _ExeDir = Application.ExecutablePath.Substring(0, _

            Application.ExecutablePath.LastIndexOf("\"))

            _PathStr = _ExeDir & "\images"

           

            If (Not Directory.Exists(_PathStr)) Then

                _PathStr = _ExeDir & "\..\..\images"

                If (Not Directory.Exists(_PathStr)) Then

                    Throw New DirectoryNotFoundException("Cannot find directory " & _PathStr & ". Fatal error.")

                End If

            End If

        End If

        GetDataDirectory = _PathStr

End Function

Comments

Popular posts from this blog

Upgrading to .NET8 from desktop versions 4.8.X

GHL Chat Bots for Webpage

GHL > Set website so shorter URL address