I have a solution which contains MVC and WebApi projects. What I want to do is to to publish them both with a single click.
I would like MVC project to go to a root folder ..\MyApp\
and WebApi to ..\MyApp\Api\
.
I think I've seen such solution, but I just cannot find it any where.
It is possible to publish multiple projects in one solution by creating a macro. An example of this is on MSDN
The physical path is going to be determined by your publishing method. You could set up the publishing wizard to just point to the physical path that you want. Then you'd have to configure IIS to ensure that both applications can coexist.
As far the routing, that will be taken care of by Web API's built in routing. If you configure your web server to host the application at
/myapp
and the API in a virtual directory at/myapp/api
, you'll need to change the routing in Web API to eliminate theapi
prefix.This will tell Web API to hang all of it's routes off of
/
instead of/api
since/api
is now where the root of the application is hosted, and that path will come from IIS.To further answer the questions, please specify what method you are using to publish.