1

First, long time reader, first time poster.

Let's say that you have 2 clickonce folders, Prod and Dev. If the application is installed from Prod you want it to access database ABC_Prod. If the application is installed from Dev you want it to access database ABC_Dev.

Is there a way for the running clickonce application to know what folder it was installed from? A manifest or config that contains this? I'm not looking for what directory the application is running from, but installed from.

Thanks

ScottTENN
  • 11
  • 2
  • The application could be installed from any folder, so that's a rather silly way to control run-time behaviour. It would be far more appropriate for you to create two separate installation packages with that functionality built into the package. – jmcilhinney May 27 '20 at 01:36
  • Maybe use build configurations. Deploy a debug build then you can use the debug compiler directive to switch your connection string. Not sure if this works in a click once though – Hursey May 27 '20 at 05:46
  • I ask because a customer of our does this with their code, that we have to use. When the application starts it has a hard coded database and server to look for. Each location, we are a location, has a code. That code is used to lookup some configuration in the master database. So between that code and the url install path it knows which database table to access for location specific information. – ScottTENN May 27 '20 at 11:57

1 Answers1

0

I found it myself.

Imports System.Deployment.Application

Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try TextBox1.Text = ApplicationDeployment.CurrentDeployment.UpdateLocation.LocalPath Catch ex As Exception MsgBox(ex.ToString) End Try End Sub End Class

ScottTENN
  • 11
  • 2