-
Notifications
You must be signed in to change notification settings - Fork 378
Closed
Labels
Description
Hello, I have a asp.net core 5 api using Mapster and Mapster.Tool, that's the csproj where mapster is referenced
Domain.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentValidation.AspNetCore" Version="10.3.0" />
<PackageReference Include="Mapster" Version="7.2.0" />
</ItemGroup>
<ItemGroup>
<Generated Include="**\*.g.cs" />
</ItemGroup>
<Target Name="Mapster" AfterTargets="AfterBuild">
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet tool restore" />
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster model -a "$(TargetDir)$(ProjectName).dll"" />
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster extension -a "$(TargetDir)$(ProjectName).dll"" />
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster mapper -a "$(TargetDir)$(ProjectName).dll"" />
</Target>
<Target Name="CleanGenerated">
<Delete Files="@(Generated)" />
</Target>
</Project>
I'am using Mapster.Tool 8.2.
Inside Domain's project the files are organized like below
Entities Folder:
- Users
- User.cs -> with [AdaptTo("[name]CodeGenDto"),GenerateMapper]
- UserValidator.cs -> FluentValidation validator
Build on windows runs as expected and the dtos are generated.
When trying to build on debian the following error occurs at the step dotnet mapster model -a "$(TargetDir)$(ProjectName).dll""
:
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored /home/joao/dpOfficer.digital.backend/dpOfficer.Api.BusinessLogic/dpOfficerApi.BusinessLogic.csproj (in 239 ms).
Restored /home/joao/dpOfficer.digital.backend/dpOfficerApi.Infrastructure/dpOfficerApi.Infrastructure.csproj (in 239 ms).
Restored /home/joao/dpOfficer.digital.backend/dpOfficerApi.Domain/dpOfficerApi.Domain.csproj (in 239 ms).
Restored /home/joao/dpOfficer.digital.backend/dpOfficerApi.Api/dpOfficerApi.Api.csproj (in 247 ms).
dpOfficerApi.Domain -> /home/joao/dpOfficer.digital.backend/dpOfficerApi.Domain/bin/Debug/net5.0/dpOfficerApi.Domain.dll
Tool 'mapster.tool' (version '8.2.1') was restored. Available commands: dotnet-mapster
Restore was successful.
Cannot find assembly path: FluentValidation (type=package, version=10.3.0)
Cannot find assembly path: FluentValidation (type=package, version=10.3.0)
Cannot find assembly path: FluentValidation (type=package, version=10.3.0)
Cannot find assembly path: FluentValidation (type=package, version=10.3.0)
Unhandled exception. System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Could not load file or assembly 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'. The system cannot find the file specified.
Could not load file or assembly 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'. The system cannot find the file specified.
Could not load file or assembly 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'. The system cannot find the file specified.
Could not load file or assembly 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'. The system cannot find the file specified.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Mapster.Tool.Extensions.Scan(CodeGenerationConfig config, Assembly assembly) in D:\git\Mapster\src\Mapster.Tool\Extensions.cs:line 177
at Mapster.Tool.Program.GenerateModels(ModelOptions opt) in D:\git\Mapster\src\Mapster.Tool\Program.cs:line 146
at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
at Mapster.Tool.Program.Main(String[] args) in D:\git\Mapster\src\Mapster.Tool\Program.cs:line 17
System.IO.FileNotFoundException: Could not load file or assembly 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'. The system cannot find the file specified.
File name: 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'
System.IO.FileNotFoundException: Could not load file or assembly 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'. The system cannot find the file specified.
File name: 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'
System.IO.FileNotFoundException: Could not load file or assembly 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'. The system cannot find the file specified.
File name: 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'
System.IO.FileNotFoundException: Could not load file or assembly 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'. The system cannot find the file specified.
File name: 'FluentValidation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0'
/home/joao/dpOfficer.digital.backend/dpOfficerApi.Domain/dpOfficerApi.Domain.csproj(19,5): error MSB3073: The command "dotnet mapster model -a "/home/joao/dpOfficer.digital.backend/dpOfficerApi.Domain/bin/Debug/net5.0/dpOfficerApi.Domain.dll"" exited with code 134.
Build FAILED.
/home/joao/dpOfficer.digital.backend/dpOfficerApi.Domain/dpOfficerApi.Domain.csproj(19,5): error MSB3073: The command "dotnet mapster model -a "/home/joao/dpOfficer.digital.backend/dpOfficerApi.Domain/bin/Debug/net5.0/dpOfficerApi.Domain.dll"" exited with code 134.
0 Warning(s)
1 Error(s)
If i remove all Validators, the project builds fine.
Any Idea of what i might be doing wrong?
Please tell me if more info is needed.
scosta-kar and EniacMleziMelethainiel