2

The structure of the project looks so that for each entity a separate folder is allocated, which stores the mapper interface, but the generation occurs in the directory above. I need to make the mapper class be generated in the same directory as the interface regardless of the directory name.

example

My settings:

    <ItemGroup>
        <Generated Include="**/*.g.cs" />
        <!--to clean up generated files dotnet msbuild -t:CleanGenerated-->
    </ItemGroup>
    <Target Name="CleanGenerated" BeforeTargets="build">
        <Delete Files="@(Generated)" />
    </Target>
    <Target Name="Mapster" AfterTargets="AfterBuild">
        <Exec WorkingDirectory="$(ProjectDir)" Command="dotnet tool restore" />
        <!--<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster model -a &quot;$(TargetDir)$(ProjectName).dll&quot;" />
        <Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster extension -a &quot;$(TargetDir)$(ProjectName).dll&quot;" />-->
        <Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster mapper -a &quot;$(TargetDir)$(ProjectName).dll&quot;" />
    </Target>

Changing the values of the property Generated Include="**/*.g.cs" did not bring any results as well as the use of different options for Mapster.Tool (tried -n -b and -o)

Дед
  • 21
  • 2

0 Answers0