Search code examples
visual-studiovisual-studio-2010asp.net-mvc-3webformsmultiple-projects

VS2010 - 2 projects, 1 solution - debug both under 1 instance


What I want to do can't be that unusual. In my solution, I have a MVC3 project and a WebForms project. The MVC3 project is the meat & potatoes of the application- it's what the user will interact with. The 2nd project is going to be a shared "content delivery" project. It'll ultimately be shared by many projects. There is nothing in it that says it has to be WebForms, as it's meant to be static css/js/images.

On top of that, I'd like to use the built-in VS.NET development server.

I have tried a variety of things:

  1. Setting my MVC project as the start-up project with and without the "Always Start When Debugging" property set to true/false (RESULT: can't access the files in my /webforms project)
  2. Setting multiple start-up projects (RESULT: 2 instances of the development server run on different ports)
  3. Setting the WebForms project as a reference to my main MVC project(RESULT: can't access the files in my /webforms project)
  4. Setting the virtual path under Properties --> Build for my webform project (RESULT: can't access the files in my /webforms project)

My goal is to:

  • Keep these as 2 separate projects
  • When I run the MVC project, I can access the files in the other project as a virtual directory (e.g. /WebForms/images/whatever.png)
  • Keep using the VS.NET development server

As I said - it doesn't seem like this should be that hard, but I'm pulling a big fat failure.


Solution

  • Ultimately, I violated my 3rd bullet above and went ahead decided to use IIS Express.

    An overview w/ download link for it is: http://learn.iis.net/page.aspx/868/iis-express-overview/

    I had to specify the same port in the Web --> Use local IIS Web Server: http://localhost:5599/MvcApplication (ideally, this would be the root- but, I couldn't figure it out) http://localhost:5599/WebForm

    All paths to images and whatnot are absolute: /WebForm/images/whatever.jpg

    I set the WebForm property to NOT "Always start when debugging" and the Start Action of "Don't open a page. Wait for a request...".

    Overall - it solves the first 2 bullets which is really what I needed and it's still a 1-click debug (hitting F5).