Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

publish two projects in same solution

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.

like image 771
user3842764 Avatar asked Aug 31 '17 19:08

user3842764


People also ask

How do I publish an entire solution in Visual Studio?

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.


1 Answers

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:

  1. 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.

  2. 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.

like image 103
Johan Donne Avatar answered Oct 22 '22 10:10

Johan Donne