Reputation: 3101
I've made test Program for some Sharepoint WSS3 features but I have run into an odd exception.
public XmlNode GetListsCollection()
{
XmlNode nodeLists;
ShareLists.Lists lists = new ShareLists.Lists(); // <--- Exception causing line
lists.Credentials = CredentialCache.DefaultCredentials;
return nodeLists = lists.GetListCollection();
}
// Exception appears here (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"]));
}
}
This error occurred when I changed my project from .NET 4 to .NET 3.5, which was required to fix a "PlatformNotSupportException".
So I can't change it back.
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
I realise that this ConfigurationErrorsException
is a delegate, and the real exception message is the inner exception.
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.
Now this file is found and clearly present in my references, however Microsoft.CSharp
is missing (due to it being a .NET 3.5 project)
Would I be correct in assuming this is the cause? Is there a version for Frameworks under .NET 4?
I have looked in C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\
and can't see an equivalent version.
Solution:
These had to be changed
In a resx file:
<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>
In 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>
Upvotes: 3
Views: 3389
Reputation: 16077
There is no Microsoft.CSharp.dll for 3.5, but quite often it is added automatically to 4.0 projects without it being needed (unless you are using things like the dynamic keyword in which case your projects needs to be 4.0) , so I would try removing this reference.
Re version 4 of system.dll , you say this file is found and present in your references. However, if your project is for the 3.5 framework, then you should be referencing the 2.0 version of system.dll and not the framework 4 version of system.dll
Similarly, you need to make sure none of the other dlls are for framework 4.
Upvotes: 5
Reputation: 100610
It looks like you still have some 4.0 assemblies used in your tool. When you switch target to 2.0-3.5 you must stop using 4.0 assemblies. Unfortunately since you are moving to older version of the Framework there would be cases you have to change your code to not use 4.0-only features.
Upvotes: 1