Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.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
.net ILMerge忽略绑定重定向_.net_App Config_.net Assembly_Ilmerge_Assembly Binding Redirect - Fatal编程技术网

.net ILMerge忽略绑定重定向

.net ILMerge忽略绑定重定向,.net,app-config,.net-assembly,ilmerge,assembly-binding-redirect,.net,App Config,.net Assembly,Ilmerge,Assembly Binding Redirect,我有一个项目A,它引用了程序集B和程序集C。程序集B也引用了程序集C,但版本不同于项目A。两个程序集(B和C)在项目A中都是通过NuGet引用的(尽管这两个程序集都在我自己的控制下,因此如果必须的话,我可以更改它们的构建方式) 我希望这张图片能说明我的意思: 程序集层次结构: 在项目A中,我有一个app.config,它在程序集C上有一个bindingRedirect,用于指向从0.0.0.0到1.1.0.0到1.1.0.0的所有版本: <dependentAssembly>

我有一个项目A,它引用了程序集B和程序集C。程序集B也引用了程序集C,但版本不同于项目A。两个程序集(B和C)在项目A中都是通过NuGet引用的(尽管这两个程序集都在我自己的控制下,因此如果必须的话,我可以更改它们的构建方式) 我希望这张图片能说明我的意思: 程序集层次结构:

在项目A中,我有一个app.config,它在程序集C上有一个bindingRedirect,用于指向从0.0.0.0到1.1.0.0到1.1.0.0的所有版本:

<dependentAssembly>
    <assemblyIdentity name="C" publicKeyToken="447cd79fe2efd739" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
  </dependentAssembly>
如果我将程序集B的项目更新为指向程序集C的1.1版,那么一切都正常工作,但这不是我想要实现的

所以我认为问题是,ILMerge没有考虑项目A的app.config。 你知道如何在不总是更新层次结构链中的所有项目的情况下解决这个问题吗?或者任何关于我做错了什么的建议?

支持此场景,并将对汇编C的任何调用重定向到合并版本


但是,它在执行此操作时不查看绑定重定向,并假定您请求合并的版本(在命令行上)是您唯一要使用的版本。如果版本
1.0
1.1
以不兼容的方式存在差异(例如,B中使用的类型已从C
1.1
中删除),则不会真正定义行为,我发现的另一个解决方案是不涉及项目C的AssemblyVersion属性,而是使用AssemblyInformationalVersion属性。通过这种方式,我可以使用NuGet部署新版本,而不必更新层次结构链中的所有项目。
There was an error merging the assemblies: 
An exception occurred during merging:
Unresolved assembly reference not allowed: C.
   bei System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly)
   bei System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type)
   bei System.Compiler.Ir2md.VisitReferencedType(TypeNode type)
   bei System.Compiler.Ir2md.VisitMethod(Method method)
   bei System.Compiler.Ir2md.VisitClass(Class Class)
   bei System.Compiler.Ir2md.VisitModule(Module module)
   bei System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)
   bei System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer)
   bei System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName)
   bei System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module)
   bei ILMerging.ILMerge.Merge()
   bei ILMerging.ILMerge.Main(String[] args)