Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.
This repository was archived by the owner on May 17, 2024. It is now read-only.

try-convert can be smart, add condition when encountering a dll with a different name #467

@sgalcheung

Description

@sgalcheung

as usual, I use try-convert command, migration old csproj template to new, but unlucky, when run host project, a issue appear, Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified
Finally I found a workaround, using the multi-target framework

<ItemGroup Condition="'$(TargetFramework)'=='net472' Or '$(TargetFramework)'=='net461'">
  <Reference Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
  <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>

I think, this is probably because of the problem caused by the dll name change in nef and net core. Based on this situation, add layer judgment, when encountering such a difference name this type of dll, automatically use the multi-target framework

relation issue

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