问题描述
尝试将SharpSVN添加到我的C#项目中时,使用SharpSVN相关的调用进行编译会给我以下错误:
When trying to add SharpSVN to my C# project, compiling with SharpSVN related calls gives me this error:
未处理FileLoadException混合模式程序集是针对运行时的版本"v2.0.50727"构建的,如果没有其他配置信息,则无法在4.0运行时中加载.
FileLoadException was UnhandledMixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
我所做的是从下载的SharpSVN zip文件中添加引用,并添加了
What I did was add the References from the downloaded SharpSVN zip file and added the
using SharpSvn;
当我编译它时,它工作正常,但是当我添加时:
When I compile that it works fine, but when I add:
string targetPath = "https://bobl/svn/ConsoleApplication1";
SvnTarget target;
SvnTarget.TryParse(targetPath, out target);
它因该错误而中断.我已经搜索了此错误,但没有找到解决办法的运气.
It breaks with that error. I've searched this error and have had no luck in finding a solution.
推荐答案
SharpSVN程序集是针对CLR 2.0版构建的混合程序集.
因此,不能在CLR 4.0版中加载它.
The SharpSVN assembly is a mixed assembly built against version 2.0 of the CLR.
Therefore, it cannot be loaded in CLR version 4.0.
您需要在项目属性中将项目更改为目标.Net 3.5(或更早版本).
由于.Net 2.0,.Net 3.0和.Net 3.5都使用CLR的2.0版,因此它可以在任何这些版本中使用.
You need to change your project to target .Net 3.5 (or earlier) in Project Properties.
Since .Net 2.0, .Net 3.0, and .Net 3.5 all use version 2.0 of the CLR, it will work in any of those versions.
这篇关于SharpSVN和C#问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!