gpt4 book ai didi

c# - 从 .NET 4.0 项目创建 .NET 3.5 版本

转载 作者:行者123 更新时间:2023-11-30 19:32:20 27 4
gpt4 key购买 nike

我有一个在 4.0 中开发的 WCF 应用程序。它使用文件路径的设置(例如日志文件的路径)。当我想构建一个 3.5 版本时,它给了我一个 ConfigurationErrorException ,上面写着:

"An error occurred creating the configuration section handler for userSettings/WCF_SmartStatsHost.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:\Users\Pierre\Documents\Visual Studio 2010\Projects\WCF_SmartStats\WCF_SmartStatsHost\bin\Debug"

我已经检查并重新检查了文件路径等,但它看起来比这更技术化。

这是堆栈跟踪:

at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ClientSettingsStore.ReadSettings(String sectionName, Boolean isUserScoped)
at System.Configuration.LocalFileSettingsProvider.GetPropertyValues(SettingsContext context, SettingsPropertyCollection properties)
at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)
at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
at System.Configuration.SettingsBase.get_Item(String propertyName)
at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
at WCF_SmartStatsHost.Properties.Settings.get_LogPath() in C:\Users\Pierre\Documents\Visual Studio 2010\Projects\WCF_SmartStats\WCF_SmartStatsHost\Properties\Settings.Designer.cs:line 32
at WCF_SmartStatsHost.Host_Logging.CreateActivityLog(String message) in C:\Users\Pierre\Documents\Visual Studio 2010\Projects\WCF_SmartStats\WCF_SmartStatsHost\Host_Logging.cs:line 17
at WCF_SmartStatsHost.Host_Processor.Start() in C:\Users\Pierre\Documents\Visual Studio 2010\Projects\WCF_SmartStats\WCF_SmartStatsHost\Host_Processor.cs:line 24
at WCF_SmartStatsHost.Host_Program.Main(String[] args) in C:\Users\Pierre\Documents\Visual Studio 2010\Projects\WCF_SmartStats\WCF_SmartStatsHost\Host_Program.cs:line 20
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

如有任何帮助,我们将不胜感激。

最佳答案

检查您的引用(在解决方案资源管理器中右键单击属性)是否已将它们设置为“特定版本=true”。将其更改为 false,然后重试。

这是错误消息中的重要部分:

An error occurred creating the configuration section handler for userSettings/WCF_SmartStatsHost.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:\Users\Pierre\Documents\Visual Studio 2010\Projects\WCF_SmartStats\WCF_SmartStatsHost\bin\Debug

关于c# - 从 .NET 4.0 项目创建 .NET 3.5 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5577584/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com