关于.NET Core 2.0.2升级到2.1.1版本相关问题
程序员文章站
2022-07-10 16:48:13
之前,因日常任务管理比较混乱,所以自己开发了PTager任务管理系统。 当时用了.NET Core 2.0版本。 现在想修改相关功能,但.NET Core已发布到2.1.301了,也即2.1.1。 附上修改前的csproj文件: 因为2.1的版本开始,就不建议直接用 Microsoft.AspNet ......
之前,因日常任务管理比较混乱,所以自己开发了PTager任务管理系统。
当时用了.NET Core 2.0版本。
现在想修改相关功能,但.NET Core已发布到2.1.301了,也即2.1.1。
附上修改前的csproj文件:
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> <UserSecretsId>aspnet-***-05A5CB6C-2204-4A9F-A965-F9D775FAEBFE</UserSecretsId> </PropertyGroup> <ItemGroup> <PackageReference Include="BuildBundlerMinifier" Version="2.6.375" /> <PackageReference Include="MailKit" Version="2.0.2" /> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" /> <PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-preview2-final" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="1.0.0-preview2-final" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.1" PrivateAssets="All" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.2" PrivateAssets="All" /> <PackageReference Include="NUglify" Version="1.5.10" /> </ItemGroup> <ItemGroup> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" /> <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" /> <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" /> </ItemGroup> </Project>
因为2.1的版本开始,就不建议直接用 Microsoft.AspNetCore.All,所以修改为 Microsoft.AspNetCore.App
其中因为默认用了本地安装的.NET Core 2.1.0,所以和SignalR的1.0.1版本有Http版本引用的冲突,所以需要制定*.App的版本号为2.1.1
修改后的csproj文件如下:
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> <UserSecretsId>aspnet-***-05A5CB6C-2204-4A9F-A965-F9D775FAEBFE</UserSecretsId> </PropertyGroup> <ItemGroup> <PackageReference Include="BuildBundlerMinifier" Version="2.8.391" /> <PackageReference Include="MailKit" Version="2.0.4" /> <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" /> <PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.1" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="1.0.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.1" PrivateAssets="All" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" PrivateAssets="All" /> <PackageReference Include="NUglify" Version="1.5.11" /> </ItemGroup> <ItemGroup> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" /> <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" /> <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" /> </ItemGroup> </Project>