[英]Asp.net c# Class library dlls right version not loading correctly
I created a class library and called id sharepointClassSample library.我创建了一个 class 库并调用了 id sharepointClassSample 库。 It has a reference to Microsoft.Sharepoint.Client.dll version 16.1.0.0 along other ones.
它引用了 Microsoft.Sharepoint.Client.dll 版本 16.1.0.0 以及其他版本。
I compiled the library and moved the resulted files to a folder called myLibrary我编译了库并将生成的文件移动到名为 myLibrary 的文件夹中
I created a project and referenced the sharepointClassSample.dll within the myLibrary folder.我创建了一个项目并在 myLibrary 文件夹中引用了 sharepointClassSample.dll。 Compiled the project and all the dlls needed by the sharepointClassSample.dll library were copied to my project bin/debug folder.
编译项目并将 sharepointClassSample.dll 库所需的所有 dll 复制到我的项目 bin/debug 文件夹中。
But the Microsoft.Sharepoint.Client.dll copied on my folder is 15.0.0.0但是复制到我的文件夹中的 Microsoft.Sharepoint.Client.dll 是 15.0.0.0
Is there a way or setting within the Class library project that allow to specify the right dlls versions to be copied when the library is referenced? Class 库项目中是否有一种方法或设置允许在引用库时指定要复制的正确 dll 版本?
For example:例如:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
In addition, redirect rules can specify to redirect within a certain version range另外,重定向规则可以指定在某个版本范围内重定向
You can also use the NuGet package manager: Add the required DLL using the NuGet package manager in the class library project and specify the required version.也可以使用NuGet package管理器:在class库项目中使用NuGet package管理器添加需要的DLL并指定需要的版本。
Manually add DLL: Copy the DLL file to the class library project and add a reference in the project.手动添加DLL:将DLL文件复制到class库工程中,在工程中添加引用。
When referencing a library, setting the build action to copy to output directory on the reference properties does not result in a version change.引用库时,将构建操作设置为复制到引用属性上的 output 目录不会导致版本更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.