publish two projects in same solution
Asked Answered
E

2

6

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.

Ellerd answered 31/8, 2017 at 19:43 Comment(2)
In release mode, do all projects have a check mark for build?Pitchy
are you trying to publish both your API project and MVC project to one web app?Roorback
B
9

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.

Bodyguard answered 31/8, 2017 at 21:21 Comment(0)
U
0
msbuild MyProject.csproj /p:DeployOnBuild=true;PublishProfile=<profile-name>;Password=<insert-password>

https://mcmap.net/q/117101/-how-to-publish-web-with-msbuild has the answer.

Note: It has some spurious information (regarding passing vs version) though. For example, I tested the command out out just now and it worked fine without the /p:VisualStudioVersion=11.0 in Visual Studio 2019 Developer Command Prompt.

Urissa answered 22/2, 2020 at 7:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.