Mapster.Tool Code Generation for Specific Project

817 Views Asked by At

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?

1

There are 1 best solutions below

1
On BEST ANSWER

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.