Reputation: 8149
I have a solution that contains a number of projects. One is an asp.net project, and is set-up to use the asp.net development server. The other projects have nothing to do with asp.net: for example, some are windows services written in unmanaged c++, others are c# console applications.
My problem is that if I start any of the non-asp.net projects in the debugger, Visual Studio still starts the asp.net development server. This causes problems when I am debugging program interactions using multiple instances of visual studio. When I debug the web application I do want the web server to start.
I have noticed that when I debug a non-asp.net project, the asp.net development server is started using the port number and virtual directory specified in the asp.net projects properties. There are no project dependencies between these projects.
Is there a way to tell visual studio to start the development server only for projects that actually specify that it should be used?
Edit 1: To reproduce this behaviour:
fgetchar()
to the generated main()
so that it doesn't immediately exit when it is run.Edit 2: Clarified that I want the server to start when I debug the web project, but not when I debug the other non-web projects.
Upvotes: 1
Views: 1159
Reputation: 8149
I have a solution that works for me.
It appears that web projects have a property that controls whether the asp.net development server is started when the debugger starts, even if the web project is not itself being debugged.
To change this property, select the web project in the solution explorer and press F4 to access a property grid. In the grid, under the heading Development Server, is a boolean property named Always Start When Debugging. The default value is true.
When I set this property to false the asp.net development server no longer started when I debugged a non-web application project.
The property is persisted in <ProjName>.csproj.user
, not <ProjName>.csproj
.
Upvotes: 2
Reputation: 1678
In the properties of the web project, under the tab "Web" you can change the startup behaviour to "Use Custom Web server". This will stop VS invoking IIS or the ASP.NET Dev server instance.
Upvotes: 0