Record the process of upgrading the. NET Core 1.x App and the. NET Standard 1.x project to version 2.0 and encountering NuGet dependencies
Today I'm going to put a long, motionless app with. NET Core 1.0.4 and the library that he relies on is written in. NET Standard 1.6 and upgraded to version 2.0
The process of upgrading also encountered some problems on the way, recorded here
I have a visual Studio 2017 (15.4) version that opens a long, open solution that appears
The report shows no errors after the upgrade
But it actually compiles, but it looks like the upgrade process, the. NET Standard NuGet package was dropped, causing other nuget suites that were originally dependent on the newer. NET Standard to become unusable
A want to say to NuGet Netstandard.library upgrade to 2.0, but in the discovery version of 2.0, but can not press ... Show blocked by project
It looks like you can only change the version of the project manually.
First, open the library's Csporj file with a text editor
Change TargetFramework to Netstandard2.0,netstandardimplicitpackageversion 2.0.0
Here is the version after the change
<project sdk= "MICROSOFT.NET.SDK" > <PropertyGroup> <TargetFramework> Netstandard2.0</targetframework> <AssemblyName>Lib</AssemblyName> <packageid>lib</ Packageid> <NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion> < packagetargetfallback>$ (packagetargetfallback);d nxcore50</packagetargetfallback> < Generateassemblyconfigurationattribute>false</generateassemblyconfigurationattribute> < Generateassemblycompanyattribute>false</generateassemblycompanyattribute> < Generateassemblyproductattribute>false</generateassemblyproductattribute> </PropertyGroup> < itemgroup> <packagereference include= "Newtonsoft.json" version= "10.0.2"/> <packagereference "Include=" SQLITE-NET-PCL "version=" 1.3.1/> </ItemGroup> </project>
Then open the csproj of the. Net Core App
Change TargetFramework to Netcoreapp2.0,runtimeframeworkversion 2.0.0
<project sdk= "MICROSOFT.NET.SDK" >
<PropertyGroup>
<targetframework>netcoreapp2.0</ targetframework>
<AssemblyName>Project</AssemblyName>
<outputtype>exe</ outputtype>
<PackageId>Project</PackageId>
<runtimeframeworkversion>2.0.0</ Runtimeframeworkversion>
<packagetargetfallback>$ (packagetargetfallback);d nxcore50</ Packagetargetfallback>
<generateassemblyconfigurationattribute>false</ Generateassemblyconfigurationattribute>
<generateassemblycompanyattribute>false</ Generateassemblycompanyattribute>
<generateassemblyproductattribute>false</ generateassemblyproductattribute>
</PropertyGroup>
<ItemGroup>
< Projectreference include= ". \lib\lib.csproj "/>
</ItemGroup>
</Project>
After rebuilding, it can be compiled successfully pull ~ ~
========== Rebuild: 2 success, 0 failure, 0 skip ==========
If there is still a mistake, you can go to each project to see if the target Framework is 2.0.
From: Technical notes of dotblogs.com.tw mushroom