Skip to content

mapster.tool does not support .net 6 #391

Description

@hirol888

mapster.tool does not support .net 6, I got this error:

1>Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
1> at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
1> at System.Reflection.RuntimeModule.GetTypes()
1> at System.Reflection.Assembly.GetTypes()
1> at Mapster.Tool.Extensions.Scan(CodeGenerationConfig config, Assembly assembly) in D:\git\Mapster\src\Mapster.Tool\Extensions.cs:line 177
1> at Mapster.Tool.Program.GenerateModels(ModelOptions opt) in D:\git\Mapster\src\Mapster.Tool\Program.cs:line 146
1> at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action1 action)
1> at Mapster.Tool.Program.Main(String[] args) in D:\git\Mapster\src\Mapster.Tool\Program.cs:line 17

Activity

  1. idarb-oss commented on Nov 20, 2021

    @idarb-oss

    Duplicates issue #381 and can be Resolved by #390

  2. Philippe-Laval commented on Dec 29, 2021

    @Philippe-Laval
    Contributor

    Hi all,
    I have created a pull request based on the modifications here
    https://github.com/Philippe-Laval/Mapster

    All projects are compiled under net6.0 and you can use the mapster.tool without the exception described.

    I created a small example of how to use the tool unitil we can have a regular tool based on nuget.
    https://github.com/Philippe-Laval/TestMapster

  3. MathieuDR commented on Jan 13, 2022

    @MathieuDR

    Hi all, I have created a pull request based on the modifications here https://github.com/Philippe-Laval/Mapster

    All projects are compiled under net6.0 and you can use the mapster.tool without the exception described.

    I created a small example of how to use the tool unitil we can have a regular tool based on nuget. https://github.com/Philippe-Laval/TestMapster

    Your example still uses the mapster tool though? What am I missing.

  4. Philippe-Laval commented on Jan 13, 2022

    @Philippe-Laval
    Contributor

    The Mapster.Tool.exe tool from the last nuget is not working (at least if you have net6.0 SDK installed on your computer - in my case a Macintosh). So I changed the source code (PR) to have my build of the tool working :
    Here is how I managed to generate code (using my build of Mapster.Tool.exe).
    I left usage of the Nuget tool for later when the Nuget version will work too but I don't see any PR being applied. The project seems dead ?

    // How to generate code with Mapster.Tool.exe
    // cd C:\Users\philippe\source\repos\Philippe-Laval\TestMapster\TestMapster.Dto
    // C:\Users\philippe\source\repos\Philippe-Laval\Mapster\src\Mapster.Tool\bin\Debug\net6.0\Mapster.Tool.exe model -a "C:\Users\philippe\source\repos\Philippe-Laval\TestMapster\TestMapster.Dto\bin\Debug\net6.0\TestMapster.Dto.dll" -n TestMapster.Dtos.Dtos -o Dtos
    // C:\Users\philippe\source\repos\Philippe-Laval\Mapster\src\Mapster.Tool\bin\Debug\net6.0\Mapster.Tool.exe extension -a "C:\Users\philippe\source\repos\Philippe-Laval\TestMapster\TestMapster.Dto\bin\Debug\net6.0\TestMapster.Dto.dll" -n TestMapster.Dtos.Dtos -o Dtos
    // C:\Users\philippe\source\repos\Philippe-Laval\Mapster\src\Mapster.Tool\bin\Debug\net6.0\Mapster.Tool.exe mapper -a "C:\Users\philippe\source\repos\Philippe-Laval\TestMapster\TestMapster.Dto\bin\Debug\net6.0\TestMapster.Dto.dll" -n TestMapster.Dtos.Mappers -o Mappers

  5. andrerav commented on Feb 20, 2022

    @andrerav
    Member

    Please try the latest version now available on NuGet and let me know how it goes. I'm on standby to resolve any issues you may encounter.

  6. devreepiet commented on Feb 21, 2022

    @devreepiet

    Hello,

    I am new to this conversation, but followed it quite closely.
    I can confirm that it works on net6.0 now.

    Good job @andrerav.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions