I am currently running into an issue where I have an mvc project and an API project in the same solution,Visual Studio 2017. when I build the solution the structure is as follows solution solution/area1 solution/area2 solution/api I am able to reach the api with no issues when just building on my local machine, but when I go to publish the solution the api project builds the dlls but does not build out the solution/api so I cannot navigate to my api calls. I have tried setting up multiple start up solutions which did not resolve the issue.
To publish your app from Visual Studio, do the following: Change the solution configuration from Debug to Release on the toolbar to build a Release (rather than a Debug) version of your app. Right-click on the project (not the solution) in Solution Explorer and select Publish. In the Publish tab, select Publish.
When you build on your local machine, you probably use '(Re)Build solution', which builds all projects in the solution. However, there is no such thing as 'Publish solution'. You can only publish a Project. When you do that, only the project and all its dependencies are built & published. if your API is in a seperate project and not referenced from the MVC site, it will not be built nor published together with that MVC application.
There are two viable approaches:
You integrate the API in the MVC site (same domain, same routing mechanism, probably seperate area). In that case I would suggest keeping it in the same project for simplicity.
You develop the API as a seperate application in its own (sub)domain. Here you put it in its own project. And you build and publish it on its own, seperate from the MVC application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With