Skip to content
This repository has been 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

Open
sgalcheung opened this issue Feb 14, 2023 · 0 comments

Comments

@sgalcheung
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant