473,729 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=Fals e") 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 8778
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:

<ConnectionStri ngs>

<add key="Prod" value="YourProd uctionConnectio nString" />
<add key="QA" value="YourQACo nnectionString" />
<add key="INT" value="YourInte grationConnecti onString" />

</ConnectionStrin gs>

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 DeploymentProvi der (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.Deploym ent)
and using:

Uri updateLocation =
System.Deployme nt.Application. ApplicationDepl oyment.CurrentD eployment.Updat eLocation;

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=Fals e") 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
4549
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 'ClickOnce_1_0_0_3.application' from… Warning: Could not download 'ClickOnce_1_0_0_3/ClickOnce.exe.config.deploy' from… Warning: Could not download 'ClickOnce_1_0_0_3/ClickOnce.exe.deploy' from…
11
14667
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 application folder was set to 'Allow scripts only', I get an error: Failed to connect to 'http://192.168.0.5/TransAct/' with the following error:
4
5688
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 calling MSBuild). So MSBuild builds and publishes the app - in the process it takes all the files and creates a hash. The problem is that the hash would be different for every site (since app.config is different). Is there a utility (or an...
2
2740
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 to web services, which then connect to a database. The tiers are all on different nodes and we have around 1000 client users. We currently deploy the web services with Wise and adjust the database (cluster) manually. The clients should be...
6
6842
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 does not copy the Application.Config file when it deploys. How can i be able to do it, Am i missing something in ClickOnce. Thanks
0
1388
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 Mode. Is the default mode and occurs when the App have an Internet connection. In this mode the App connects to a SQL Server 2005 database using a XML Web Service. Both WS and SQL Server runs on the WebServer wich also works as App and Database...
0
1833
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 Mode. Is the default mode and occurs when the App have an Internet connection. In this mode the App connects to a SQL Server 2005 database using a XML Web Service. Both WS and SQL Server runs on the WebServer wich also works as App and Database...
0
2728
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 each client gets it perfectly. The probelm is that I have a 4-tier environment, one for each phase of the development lifecycle. I need the DEV version of the app to hit the DEV version of the web service, TEST to TEST, QA to QA, and PROD to...
3
4010
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 application is immediately run and the config file is encrypted immediately. How ever, when the application is deployed a second directory with "_none_" in the name is created and the app.config is copied there too.The app.config in the _none_...
0
8913
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9280
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6016
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.