Question about different buils/compiles (dev, test, production enviroment) (Help needed !)

B

Benne Smith

In our company, i have three servers;

1) a development server (mine only - here i make daily changes and test my
stuff)
2) a test server (for the users to test milestone builds - changes weekly)
3) production server (for when a new build is fully tested, and stable)

The problem is that the connectionstring in the web.config, should be
replaced with something else, for each of the enviroments.

Another problem is that, i use wsdl.exe to generate proxy classes to
communicate with my webservices. And these have the "this.Url" property
hardcoded to the webservice (starting with the development enviroment -
since that's the first release).

How can I;

1) Easily choose between a Development, Test, Production, so that the the
data in the web.config corresponds to what i want ?
2) Easily change a week old build of my exe, which has build in proxy
classes to the webservices, to point at another webservice ?

I'm looking for a solution that's easy to use from inside .NET, so i don't
have to manage ugly .bat files or something like this.

Thanks.

PS : I know i can put different keys into web.config, and make contants in
my code, but this means i have to recompile. I don't want this, i just want
to change an entire application from the state of (for example)
"development" to "test" with the 'click of a button' :)
 
H

Horatiu Ripa

1. Strange. Why and where do you have the URL in web.config file? If you
REALLY need url references in web config why didn't you use relative paths?
2. Change the proxy constructor to Service(string ServerURL) and modify
this.url = "http://webserver/blablabla"; to this.url = ServerURL +
"blablabla";
Then, on client side you can store the ServerURL string in a file or
something, to retrieve it when the client application starts, and change it
whenever you want to switch to another server.
 
B

Benne Smith

Hi, and thanks for your reply.

The "this.Url" is in the generated proxy class (wsdl.exe), not in the
web.config. And if i manually have to update this url, it really a bommer,
because I generate this proxy class, every time i extend my webservice (many
times a day).

In the web.config (the webservices) is located the connectionstrings, they
also change for each enviroment.

I see your idea, but it's not nearly flexible enough.

If you have more ideas, please post more.

Thanks !

:) Benne
 
D

Dan Cimpoiesu

You can create different configurations like Debug and Release let say,
Development,Production,Testing

Than you must define for each configuration Conditional Compilation
Constants (in Project Properties) (let say also
Development,Production,Testing)

then define in code some variables depending on the configuration

in c# is like that

#if (Production)
public static String ConnectionString="some connection string...";
#endif

#if (Development)
public static String ConnectionString="other connection string...";
#endif

Then choose the configuration you want and make a build

You also can make different configurations file for each configuration and
set them from configuration properties

Hope this helps

Dan Cimpoiesu
 
B

Benne Smith

hi dan thanks for your reply,

Ah ok ! that helped to understand the configuration changes. but i'll still
need external bat files to generate my webservice proxyclasses to different
url locations (dev, test, prod). everything can't re accomplished from
inside the development enviroment, right ?

an example;

if i change the configuration to Development, and compile, i would like it
to autogenerate proxy classes (wsdl.exe) to a certain url (another url than
Test and Prod).

Thanks !

:) Benne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top