Link to home
Start Free TrialLog in
Avatar of Mahesh Yadav
Mahesh YadavFlag for India

asked on

how to add a config file in visual studio sql server project

I have created a sql server project in visual studio 2005 (C#).
in this project I have added a web Reference to a web service.
Now I need to figure our one way by which I can change service URL without recompiling the project and then regenerate the dlls.

some thing like adding the URL in config file
ASKER CERTIFIED SOLUTION
Avatar of byfour
byfour
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have worked with this before.  And the web reference when adding to the VS project will hook up to the service and create a soap type xml file that basically give the structure of the web service calls that can be made so the compiler knows.

So as long it is the SAME soap you can program it to change by doing this.

        APIref.PSAPIService apiService = new APIref.PSAPIService ();
        apiService.Url = <url>

APIRef is the alias name of the web service you added.
PSAPIService is the name that the web service is called
then assign the url.

Again to be clear the SOAP calls need to be identical otherwise it can produce errors.

We needed to do this so we could easily go from unit testing to qa testing to production servers with out a recompile.

Hope this helps.

Avatar of AVONFRS
AVONFRS

You can right click your project in Visual Studio > Add New Item > Config File

It will automatically create a config file for you and then you add the necessary values.