![](/img/trans.png)
[英]c# properties/settings not defined after changing project name and namespace
[英]How to permanently rename C# project's Properties namespace
在另一个项目中,我有使用名称Properties
类,因此当预生成的Settings和Resources的Properties名称空间遇到问题时,使用它们很麻烦。 有没有办法强制此名称空间即使在对资源或设置进行修改后仍保持重命名?
以下是引起问题的文件。
Resources.Designer.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectNamespace.Properties {
using System;
Settings.Designer.cs
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectNamespace.Properties {
如果不清楚。 我想重命名Properties
而不是ProjectName
。
听起来好像您已经通过项目属性窗口的相应选项卡下添加了Settings
和Resources
文件(可以在其中为这些项目添加默认文件)。 当您以这种方式执行此操作时,名称.Properties
会附加到命名空间中,并且它们会组织在“ Solution Explorer
”中项目的“ Properties
节点下:
而是尝试将它们添加为单独的项目。 为此,请右键单击您的项目,选择“ Add --> New Item
,在“ Visual C# Items
下选择“ General
标题,然后可以添加新的Resources File
和/或Settings File
:
这些文件将像其他任何项一样添加到您的项目中(不在“ Properties
节点下),并且将使用项目的默认名称空间,并且不会向其中添加.Properties
:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.