0

I have a Visual Studio solution containing various sample console app projects. One of which is MapsterSample where I am trying out Mapster and following the steps described on GitHub https://github.com/MapsterMapper/Mapster/wiki/Mapster.Tool to generate mapping code.

Everything seems fine except for the part where I issue the command:

dotnet msbuild -t:Mapster

This results in the command executing for every project in the solution even if MapsterSample is selected as Default project in Package Manager Console:

SampleSolution\FirstSample\FirstSample.csproj : error MSB4057: The target "Mapster" does not exist in the project.
SampleSolution\SecondSample\SecondSample.csproj : error MSB4057: The target "Mapster" does not exist in the project.
... and so on

Is there a way to just execute the command for the MapsterSample project?

Patee Gutee
  • 292
  • 2
  • 19

1 Answers1

1

Make sure the project exists within your solution.

Make sure that the name Mapster is spelled correctly.

Make sure your terminal is in the correct directory. (ideally you should be in the directory ABOVE the directory the .csproj for Mapster is in.

DekuDesu
  • 2,224
  • 1
  • 5
  • 19
  • 1
    It turns out I need to do a CD .\MapsterSample to jump to the project's folder where I want to generate code. I thought by selecting MapsterSample as default in the Package Manager Console, VS automatically runs commands in the selected projects folder. – Patee Gutee May 15 '21 at 21:21