我已经为某些Sharepoint WSS3功能制作了测试程序,但是我遇到了一个奇怪的例外。.NET DLLs冲突
public XmlNode GetListsCollection()
{
XmlNode nodeLists;
ShareLists.Lists lists = new ShareLists.Lists(); // <--- Exception causing line
lists.Credentials = CredentialCache.DefaultCredentials;
return nodeLists = lists.GetListCollection();
}
//异常出现在这里(Settings.Designer.cs)
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://uk-tr-dsf/_vti_bin/Lists.asmx")]
public string SharepointWeb_ShareLists_Lists {
get {
return ((string)(this["SharepointWeb_ShareLists_Lists"]));
}
}
当我改变了我的项目从.NET 4.0到.NET 3.5,这是不需要解决“发生此错误PlatformNotSupportException”。
所以我不能改回来。
System.Configuration.ConfigurationErrorsException was unhandled
Message=An error occurred creating the configuration section handler for applicationSettings/SharepointWeb.Properties.Settings: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. (C:\Working\SharepointPlugin\SharepointWeb\bin\Debug\SharepointWeb.vshost.exe.Config line 5)
Source=System.Configuration
BareMessage=An error occurred creating the configuration section handler for applicationSettings/SharepointWeb.Properties.Settings: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
Filename=C:\Working\SharepointPlugin\SharepointWeb\bin\Debug\SharepointWeb.vshost.exe.Config
Line=5
Stacktrace: ... omitted
我知道这ConfigurationErrorsException
为代表,而真正的异常消息是内部异常。
System.IO.FileNotFoundException
Message=Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
现在,这个文件被发现,清晰地呈现在我的参考,但是Microsoft.CSharp
丢失(由于它是一个.NET 3.5的项目) 我将是假设这是原因是否正确? .NET 4下有框架的版本吗? 我查看过C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\
,看不到同等版本。
解决方案:
这些都必须加以改变
在RESX文件:
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
在app.config中:
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="SharepointWeb.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
我现在有比V2更高的项目的唯一DLL是System.Core运行在v3.5与我的项目相同。然而,例外依然存在。 – Amicable
在这种情况下,我认为您可能需要在源文件夹中的每个文件中搜索Version = 4.0.0.0,以查看是否告诉您指向system.dll的内容。例如,它可能是一个.resx文件 – sgmoore
搜索版本= 4.0.0.0显示了在我的App.Config和Form1.resx文件中引用了有问题的PKT的DLL。 我没想到能够以纯文本的方式找到它!活到老,学到老。 – Amicable