Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 Launches Wrong Project For Debugging

I've got an ASP.NET web application project in a Visual Studio 2012 solution. I'll refer to this as A.

I copied A's directory to a new directory to make a clone of it. I'll refer to this as B.

I made extensive changes to both A and B to the point that they are not even remotely similar. Stylesheets, scripts, HTML, and back end is all different.

I launched A for debugging, and it appeared in my browser as expected. I debugged the application for awhile, and then terminated debugging via the "stop debugging" icon on the toolbar within Visual Studio 2012.

I then launched B for debugging. Instead, I got A.

I tried clearing browser cache, though, this couldn't be the problem because the server side of the application was wrong too.

I tried Rebuilding the project, after running Clean. I still see A while trying to debug B.

I tried killing all processes related to the debugging session including all iisexpress.exe, MSBuild.exe, WebDev.WebServer40.EXE, Microsoft.VisualStudio.Web.Host.exe instances.

I tried closing Visual Studio 2012 completely, reopening it, and retrying debugging.

EDIT

After closing and reopening VS2012 for a third time, it started now allowing me to see B. Nothing else has changed.


Best I can come up with is there must be some type of project setting that needs to be changed to reflect that the project lives in a different space than it did before being copied, but I have yet to track down such a setting.

What am I missing?

like image 750
crush Avatar asked Dec 09 '13 20:12

crush


People also ask

How do I set Debug path in Visual Studio?

In Solution Explorer, right-click the project and choose Properties. In the side pane, choose Build (or Compile in Visual Basic). In the Configuration list at the top, choose Debug or Release. Select the Advanced button (or the Advanced Compile Options button in Visual Basic).

How do I change the debugger in Visual Studio?

To set Visual Studio debugger options, select Tools > Options, and under Debugging select or deselect the boxes next to the General options. You can restore all default settings with Tools > Import and Export Settings > Reset all settings.

How do I force stop debugging in Visual Studio?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.


2 Answers

I have just come across this issue today, having done exactly as you (copied a project, and then edited). And hence i would like to share my solution.

If you go to Project B's Properties (found in solution Explorer), you will find a Web tab:

enter image description here

In your Servers section, alter the Project Url to:

http://localhost: + (number +1) + /

and then hit Create Virtual Directory

You should then be able to re-run your project and since they're running off different Url's, you shouldn't see this clash again.

like image 189
jbutler483 Avatar answered Oct 24 '22 14:10

jbutler483


I was in the exact same situation. The problem was that both projects (Project_A & Project_B) we’re setup to run on the same port in IIS Express.

IISExpress determines the port/application by looking at a configuration file located in <Documents>\IISExpress\config\application.config.

Open that file and look for a section <sites>. You should find a list of your VS projects. Locate your projects (A and B) and make sure that both projects are not running on the same port

<site name="Project_A" id="17">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\Somefolder\ Project_A " />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:64212:localhost" />
</bindings>
</site>
<site name="Project_B" id="18">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\Somefolder\ Project_B " />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:64212:localhost" />
</bindings>
</site>

If that is the case, remove one entry (i.e. Project_B), and then go in Visual Studio to recreate the entry.

In VS, go in the Properties of Project_B. Click on Web tab and look for the “Servers” section.

Enter a new port (i.e. `http://localhost:64213`) and click on the “Create Virtual Directory” button. This will add an entry in the “application.config” file, with the new association (i.e. Project_B / port 64213)

This should fix the problem. Hope this helps

like image 44
rpg501 Avatar answered Oct 24 '22 16:10

rpg501