类型或命名空间名称'属性'不存在 [英] Type or namespace name 'Properties' does not exist
问题描述
我想在我的项目中使用应用程序设置。
I'm trying to use application settings in my project.
当我尝试在项目下面的代码行,我得到一个错误。
When I try the following line of code in the project, I get an error.
TransferLogs.Properties.Settings.Default.ValleyLastRun = timeNow;
由此产生的错误是:
类型或命名空间名称'属性'不存在命名空间'Williams.TransferLogs存在(是否缺少程序集引用?)
The type or namespace name 'Properties' does not exist in the namespace 'Williams.TransferLogs' (are you missing an assembly reference?)
我定义为我的项目 - >属性 - >设置页面上的日期时间设置ValleyLastRun。我不知道我为什么不能引用我的项目设置
I have the setting "ValleyLastRun" defined as a DateTime on my Project->Properties->Settings page. I don't know why I can't reference the setting in my project.
下面是解决方案的窗口:
Here's the solution window:
推荐答案
的问题与您的资源文件。每默认的设置为内部产生的。您可以更改上面的设置下拉框。
The problem is related to your resource file. Per default the settings are generated as internal. You can change that in the dropdown box above the settings.
有有时这个类的构造函数的一个问题,因为它仍然是内部的。您可以手动更改,但设置的每个编辑之后将被重置为内部。
There is sometimes a problem with the constructor of this class because it remains internal. You can change that manually but after every edit of the Settings it will be reset to internal.
这篇关于类型或命名空间名称'属性'不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!