将类库生成多个版本类库

参考官方文档 文档 

今天在官网上看了一篇文档,内容是如何实现在自己的类库生成多个版本的dll  然后安装上面的说明进行了实践,实现的效果如下,没去测试会不会出问题,下次有时间再详细来一遍

先贴个代码吧,以后再接着弄,,好像不能打包了,有时间再看看什么回事

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

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <NeutralLanguage>中国</NeutralLanguage>
    <RepositoryType>git</RepositoryType>
  </PropertyGroup>

<PropertyGroup>
            <TargetFrameworks>net40;net45;netstandard1.0;netstandard2.0</TargetFrameworks>
 </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)|$(TargetFramework)' == 'Debug|AnyCPU|net40'">

    <DefineConstants>TRACE;DEBUG</DefineConstants>
    <DocumentationFile>....Bin
et45XCode.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)|$(TargetFramework)' == 'Release|AnyCPU|net45'">
    
    <DefineConstants>TRACE</DefineConstants>
    <DocumentationFile>....Bin
et45XCode.xml</DocumentationFile>
  </PropertyGroup>
  
      <PropertyGroup Condition="'$(Configuration)|$(Platform)|$(TargetFramework)'=='Debug|AnyCPU|netstandard1.0'">
    
    <DocumentationFile>....Bin
etstandard1.0XCode.xml</DocumentationFile>
    <DefineConstants>TRACE;DEBUG</DefineConstants>
  </PropertyGroup>
  
    <PropertyGroup Condition="'$(Configuration)|$(Platform)|$(TargetFramework)'=='Debug|AnyCPU|netstandard2.0'">
    
    <DocumentationFile>....Bin
etstandard2.0XCode.xml</DocumentationFile>
    <DefineConstants>TRACE;DEBUG</DefineConstants>
  </PropertyGroup>
       

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DefineConstants />
    <Optimize>true</Optimize>
    <NoWarn>1701;1702;1705;1591;0618</NoWarn>
  </PropertyGroup>

</Project>

文档上还有标出,包不兼容要做处理,

原文地址:https://www.cnblogs.com/lsgControl/p/10143498.html