[英]How do I exclude a dependency of Microsoft.NETCore.APP
How do I exclude a dependency of Microsoft.NETCore.App so I can replace it with a locally compiled (bugfix) version. 如何排除Microsoft.NETCore.App的依赖项,以便可以将其替换为本地编译(错误修正)版本。
I carried out the normal procedure for replacing a package by making one with a higher version number, and tried to compile. 我执行了通过使用更高版本号制作软件包来替换软件包的正常过程,并尝试进行编译。 The build tried to link against both and died at the compile step with CS0433 due to duplicate references. 该构建尝试将两者链接在一起,并由于重复引用而在CS0433的编译步骤中终止。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\System.Threading.ThreadPool\System.Threading.ThreadPool.csproj"/>
<ProjectReference Update="..\System.Threading.ThreadPool\System.Threading.ThreadPool.csproj"/>
</ItemGroup>
</Project>
Compile error: 编译错误:
C:\\Program FFiles\\dotnet\\sdk\\2.1.604\\Microsoft.Common.CurrentVersion.targets(2114,5): warning MSB3243: No way to resolve conflict between "System.Threading.ThreadPool, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" and "System.Threading.ThreadPool, Version=4.1.1.0, Culture=neutral, PublicKeyTokn=b03f5f7f11d50a3a". C:\\ Program FFiles \\ dotnet \\ sdk \\ 2.1.604 \\ Microsoft.Common.CurrentVersion.targets(2114,5):警告MSB3243:无法解决“ System.Threading.ThreadPool版本= 5.0.0.0,区域性之间的冲突=中性,PublicKeyToken =空”和“ System.Threading.ThreadPool,版本= 4.1.1.0,文化=中性,PublicKeyTokn = b03f5f7f11d50a3a”。 Choosing "System.Threading.ThreadPool, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" arbitrarily. 任意选择“ System.Threading.ThreadPool,版本= 5.0.0.0,区域性=中性,PublicKeyToken =空”。 [path] [路径]
Program.cs(17,13): error CS0433: The type 'ThreadPool' exists in both 'System.Threading.ThreadPool, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Threading.ThreadPool, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' [path] Program.cs(17,13):错误CS0433:类型'ThreadPool'同时存在于'System.Threading.ThreadPool,Version = 4.1.1.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'和'System.Threading.ThreadPool,Version = 5.0.0.0,文化=中性,PublicKeyToken =空'[路径]
I assume you compiled corefx to produce the updated System.Threading.ThreadPool package? 我假设您编译corefx来生成更新的System.Threading.ThreadPool包?
In that case corefx has docs that spell out how do this. 在那种情况下, corefx拥有说明该操作方法的文档 。 To summarize: 总结一下:
Build corefx with your fixes 使用修复程序构建corefx
Get the version number of the corefx that you built 获取您构建的corefx的版本号
Add a PackageReference to Microsoft.Private.CoreFx.NETCoreApp
with the version from step 2 使用第2步中的版本将PackageReference添加到Microsoft.Private.CoreFx.NETCoreApp
Add a nuget.config that points to the bin directory of the corefx that you built. 添加一个nuget.config指向您构建的corefx的bin目录。
restore and publish your project to pick up the custom-modified corefx. 恢复并发布您的项目,以选择修改后的corefx。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.