SharpSVN和C#问题

Sam*_*m F 9 c# fileloadexception sharpsvn

在尝试将SharpSVN添加到我的C#项目时,使用SharpSVN相关调用进行编译会给出以下错误:

FileLoadException是未处理的混合模式程序集是针对运行时的版本"v2.0.50727"构建的,如果没有其他配置信息,则无法在4.0运行时中加载.

我所做的是从下载的SharpSVN zip文件添加引用并添加

using SharpSvn;
Run Code Online (Sandbox Code Playgroud)

当我编译它工作正常,但当我添加:

string targetPath = "https://bobl/svn/ConsoleApplication1";

SvnTarget target;
SvnTarget.TryParse(targetPath, out target);
Run Code Online (Sandbox Code Playgroud)

它打破了这个错误.我已经搜索了这个错误并且没有找到解决方案的运气.

Jul*_*ain 31

如果要继续定位.NET 4,请将其添加到app.config中:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>
Run Code Online (Sandbox Code Playgroud)

这将支持为旧版本的框架构建的混合模式程序集(主要是包含非托管代码和托管代码的C++/CLI程序集)的加载支持.


SLa*_*aks 6

SharpSVN组件是针对CLR 2.0版构建的混合组件.
因此,它无法在CLR 4.0版中加载.

您需要将项目更改为在Project Properties中定位.Net 3.5(或更早版本).
由于.Net 2.0,.Net 3.0和.Net 3.5都使用CLR的2.0版本,因此它可以在任何这些版本中使用.