Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/281.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# 根据较高版本的程序集进行编译,但绑定会重定向到app.config中的较低版本_C#_Assembly Binding Redirect - Fatal编程技术网

C# 根据较高版本的程序集进行编译,但绑定会重定向到app.config中的较低版本

C# 根据较高版本的程序集进行编译,但绑定会重定向到app.config中的较低版本,c#,assembly-binding-redirect,C#,Assembly Binding Redirect,我正在针对版本为2.0.0的第三方强名称程序集(thirdparty.dll)编译dll 但是,当我将dll和EXE发送到客户机时,我想发送thirdparty.dllversion1.0.0(不要问为什么,我有理由这么做) 这可能吗?我的理解是,是的,只要我是这样 因为对于新版本 此值可以指定比旧版本更早的版本 该代码将正常工作,除非在根据thirdparty.dllversion1.0.0编译代码时出现任何编译问题 我的理解正确吗?回答我自己的问题:是的,正确 例如: 0.0.0和2.0

我正在针对版本为
2.0.0
的第三方强名称程序集(
thirdparty.dll
)编译dll

但是,当我将dll和EXE发送到客户机时,我想发送
thirdparty.dll
version
1.0.0
(不要问为什么,我有理由这么做)

这可能吗?我的理解是,是的,只要我是这样


因为对于新版本

此值可以指定比旧版本更早的版本

该代码将正常工作,除非在根据
thirdparty.dll
version
1.0.0
编译代码时出现任何编译问题


我的理解正确吗?回答我自己的问题:是的,正确

例如:

0.0.0
2.0.0.0
之间的所有版本都将重定向到
4.0.0.0

  <dependentAssembly>
    <assemblyIdentity name="thirdparty" culture="neutral" publicKeyToken="3d67ed1f87d44c89"/>
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="1.0.0.0"/>
  </dependentAssembly>
 <dependentAssembly>
    <assemblyIdentity name="thirdparty" culture="neutral" publicKeyToken="3d67ed1f87d44c89"/>
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="1.0.0.0"/>
  </dependentAssembly>
 <dependentAssembly>
    <assemblyIdentity name="thirdparty" culture="neutral" publicKeyToken="3d67ed1f87d44c89"/>
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="4.0.0.0"/>
  </dependentAssembly>