.net standard 编写nuget多版本包不同版本或包的依赖问题解决

工程文件使用

例子:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net451;net452;net461;net462;netstandard2.1;netstandard2.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
    <PackageReference Include="Microsoft.Extensions.Configuration">
      <Version>3.1.9</Version>
    </PackageReference>
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
    <PackageReference Include="Microsoft.Extensions.Configuration">
      <Version>3.1.9</Version>
    </PackageReference>
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'net451'">
    <Reference Include="System.Configuration" /> 
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'net452'">
    <Reference Include="System.Configuration" /> 
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'net461'">
    <Reference Include="System.Configuration" /> 
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'net462'">
    <Reference Include="System.Configuration" /> 
  </ItemGroup>   
</Project>

原文地址:https://www.cnblogs.com/roinbi/p/13924092.html