try-convert icon indicating copy to clipboard operation
try-convert copied to clipboard

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

Open sgalcheung opened this issue 2 years ago • 0 comments

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

sgalcheung avatar Feb 14 '23 03:02 sgalcheung