Hi
I've built some web services and some unit tests against them.
I want these tests to operate on multiple PCs (multiple development PCs plus also the main Team Build server), but the port number used by the development web server on each PC is different so the test code (the web reference generated code) has to change on each PC - is there any way of getting the development web server to run on the same port number on each PC (I've seen http://msdn2.microsoft.com/library/ms178109(en-us,vs.80).aspx but this doesn't seem to make complete sense!).
Thanks
Stuart

How to fix the Development server's port number across different PCs?
Alex DeJarnatt - MSFT
Thanks!
I was looking in the wrong place - I was looking in the property pages not the properties window!
:-)
George Hannah
You can set this through the normal Properties window for the web project. Change Use dynamic ports to False, then specify whatever you want for Port number. This way the site will always be launched at the same port, even if you run it from another PC.
Post-beta 2, there's support for automatically starting a server when the test runs, and dynamically binding the web service object to the correct URL. If you're on a more recent CTP, you can do something like this:
using Microsoft.VisualStudio.QualityTools.UnitTesting.Framework;
using Microsoft.VisualStudio.QualityTools.UnitTesting.Web;
...
[TestMethod]
[AspNetDevelopmentServer("server1", "%PathToWebRoot%\\WebSite1")]
public void TestMethod1()
{
Service target = new Service(); //this is the web service object
Assert.IsTrue(WebServiceHelper.TryUrlRedirection(target, TestContext, "server1"), "URL redirection failed.");
//now call web methods on the target object
}
This will launch the site at %PathToWebRoot%\\WebSite1 when the test starts, and the WebServiceHelper.TryUrlRedirection() call will set the target object to use the correct URL. The use of an environment variable allows this to work across machines with different directory structures (including the build machine). I believe this support should be available in any CTP after beta 2.