472,809 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,809 software developers and data experts.

ClickOnce and app.config??

Hi,

I've have searched google, but can't find a solution to my problem.

Om my develloper machine, I use one app.config, but when I deploy, I need to
deploy another app.config.

The reason is, that on my develloper machine, my app.config sqlconnection is
pointing to my (local) database and I have several settings like
"Debug=True", but when I deploy (using ClickOnce), I need to use an
app.config with another sqlconnection string and other settings (like
"Debug=False") and so on.

Any idea?

Otherwise the ClickOnce (for me) is totally not usefull. :o)

Thanks!!!!

M O J O
Oct 12 '06 #1
1 8663
Hi,

Most people have their clickonce application talk to a service tier and
that's where they store connection strings. That way, you don't have
connection strings on the client. This is especially true if you are
using SQL Authentication. Anyway, if you have to put connection strings
on the client, you can put all of the connection strings for the
various environments in one file and, at runtime, determine what
environment you are running against and choose the proper connection
string. For example:

<ConnectionStrings>

<add key="Prod" value="YourProductionConnectionString" />
<add key="QA" value="YourQAConnectionString" />
<add key="INT" value="YourIntegrationConnectionString" />

</ConnectionStrings>

Once you have defined all of your connection strings, you need to
figure out what environment you are running against. One way to do that
is to look at the ClickOnce DeploymentProvider (i.e., the place where
ClickOnce goes to for updates). You can get to this value (which is a
URL) by adding a reference to the ClickOnce APIs (System.Deployment)
and using:

Uri updateLocation =
System.Deployment.Application.ApplicationDeploymen t.CurrentDeployment.UpdateLocation;

You can then look at the updateLocation to determine what the
environment is, which will be different for each environment. Note that
the ClickOnce APIs throw an exception if you are not running under a
ClickOnce context, so you have to deploy the application using
ClickOnce to test the above.
Hope this helps.

Thanks,
Sayed Y. Hashimi
http://www.sayedhashimi.com
My Books:

Deploying .NET Applications: Learning MSBuild and ClickOnce
http://www.amazon.com/Deploying-NET-.../dp/1590596528

Service-Oriented Smart Clients with .NET 2.0
http://www.amazon.com/exec/obidos/tg...3/qid=11263614...

M O J O wrote:
Hi,

I've have searched google, but can't find a solution to my problem.

Om my develloper machine, I use one app.config, but when I deploy, I need to
deploy another app.config.

The reason is, that on my develloper machine, my app.config sqlconnection is
pointing to my (local) database and I have several settings like
"Debug=True", but when I deploy (using ClickOnce), I need to use an
app.config with another sqlconnection string and other settings (like
"Debug=False") and so on.

Any idea?

Otherwise the ClickOnce (for me) is totally not usefull. :o)

Thanks!!!!

M O J O
Oct 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Asaf | last post by:
Hi, After publishing my test application using ClickOnce with VS.NET 2005 I am getting these warnings: Warning: Could not download 'ClickOnce.application' from… Warning: Could not download...
11
by: moondaddy | last post by:
I have a .net 2.0 smarclient app and am trying to deploy it to IIS where users can access it from. I created an application folder in IIS where I'm trying to deployee to. 1) When the...
4
by: Frank Rizzo | last post by:
I have a SmartClient/ClickOnce app that needs to be deployed to a whole bunch of sites. The app.config would have to be different for each site. I am trying to do this in an automated manner (by...
2
by: Alex Bögli | last post by:
Hi I have a rather advanced deployment scenario and wanted to know, if anyone has an idea how to accomplish that with ClickOnce: We are deploying a 3-tier application with a client connecting...
6
by: Irfan | last post by:
hi, After installing the application in the client machine using ClickOnce, i would like that the client be able to change the database path in the Application.Config file. However, clickonce...
0
by: Sergio Montero | last post by:
Hi, I've been googling for a while trying to figure out how to solve this problem, pleasy, I'll appreciate any sugestions. I have a Winforms App that should work Online and Offline. Online...
0
by: Sergio Montero | last post by:
Hi, I've been googling for a while trying to figure out how to solve this problem, pleasy, I'll appreciate any sugestions. I have a Winforms App that should work Online and Offline. Online...
0
by: jonathonmc | last post by:
I have a winform app written in C# which accesses a web service using a dynamic URL (configured in the app.config). When I deploy this app via ClickOnce it builds the app.config into the manifest and...
3
by: =?Utf-8?B?QXZpc2hheSBCZW4tWnZp?= | last post by:
Hi, I have an application that I am encrypting the connection strings on the first run of the application. I am using clickonce to deploy the application, so this was a good solution as the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.