Search code examples
c#angularasp.net-mvcvisual-studio-2022multiple-projects

Multiple projects, building wrong project first and then breaking on deploy - Visual Studio 2022 - Community


I have two projects. One for my backend (C#), one for my front end (Angular) in my build properties, I have the order with which they need to build set.

enter image description here

the ports are set for localhost:7049 for the backend and localhost:4200 for the front end However, when I start the build, in the output I get this:

enter image description here

there are no errors and the server never starts or deploys (according to the output) So then it brings up the Angular project, which works fine. then if I close the command prompt that has the publishing for the angular stuff, I get this pop up error:

enter image description here

if I click continue, it builds and deploys the backend code. Then I can right click the front end and go to Debug > Start new Instance and then they both work.

Obviously this is not ideal and not how it should work. So before I can continue working on this, I have to figure it out.

I have tried several things, some of which was repairing Visual Studio, reinstalling it, changing build order, changin dependencies under the property page in the first screenshot. I have tried changing ports, a lot of things.

Any suggestions on what to try next would be super helpful


Solution

  • I found the answer. It was my node version. as of the date of making this version 18.13 was the version I had.

    I found the answer from this: https://learn.microsoft.com/en-us/answers/questions/1109248/cant-start-frontend-and-backend-projects-at-the-sa

    long story short. my node version wasn't playing well with the multiple projects so I uninstalled node and installed version 16.16.0:

    https://nodejs.org/en/blog/release/v16.16.0/

    and then it was working