Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 有没有一种方法可以创建一个NuGet包来升级其依赖项?_C#_Nuget_Nuget Package - Fatal编程技术网

C# 有没有一种方法可以创建一个NuGet包来升级其依赖项?

C# 有没有一种方法可以创建一个NuGet包来升级其依赖项?,c#,nuget,nuget-package,C#,Nuget,Nuget Package,去年,我创建了一个NuGet包,其中包含一个DLL,并且对DocumentFormat.OpenXml NuGet项目版本2.5.0有一个依赖项。从那时起,DocumentFormat.OpenXml已经升级。如果有人试图将DocumentFormat.OpenXml升级到最新版本,我的代码将抛出以下错误: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, P

去年,我创建了一个NuGet包,其中包含一个DLL,并且对DocumentFormat.OpenXml NuGet项目版本2.5.0有一个依赖项。从那时起,DocumentFormat.OpenXml已经升级。如果有人试图将DocumentFormat.OpenXml升级到最新版本,我的代码将抛出以下错误:

Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its 
dependencies. The located assembly's manifest definition does not match 
the assembly reference. (Exception from HRESULT: 0x80131040)
我已经尝试将我的项目的AutoGenerateBindingRedirects设置为true,并将dll的“特定版本”设置为false,但这两种设置都不能帮助我的NuGet包的用户。是的,他们可以在配置文件中放入bindingRedirect并手动告诉它使用其他东西或运行PM命令(Get Project–All | Add bindingRedirect),但我试图找到一种自动化方法,这样用户就不必处理它了

如果您访问NuGet站点,他们会花费大量时间讨论如何调整NuSpec文件以允许不同的版本,但我找不到任何关于如何实际使代码接受多个版本或如何自动为用户创建bindingRedirect的指导