重命名错误的ASP.NET MVC项目
我已经复制了previous项目,并更名为。有一次,我已经成功地重新命名所有的命名空间,并建立正确。我得到了下面的错误,当我跑的应用程序:
I have copied a previous project and renamed it. Once I had successfully renamed all the name spaces and it build correctly. I got the following error when I ran the application:
The following errors occurred while attempting to load the app.
- The OwinStartup attribute discovered in assembly 'User Manager Interface' referencing startup type 'User_Manager_Interface.Startup' conflicts with the attribute in assembly 'Service Monitor Web Interface' referencing startup type 'Service_Monitor_Web_Interface.Startup' because they have the same FriendlyName ''. Remove or rename one of the attributes, or reference the desired type directly.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.
我想通了,如果我注释掉下面,那么第一行将错误消失。
I have figured out that if I comment out the first line below then the error goes away.
//[assembly: OwinStartupAttribute(typeof(Service_Monitor_Web_Interface.Startup))]
namespace Service_Monitor_Web_Interface
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}
我重新命名从User_Manager_Interface到Service_Monitor_Web_Interface解决方案。
I renamed my solution from User_Manager_Interface to Service_Monitor_Web_Interface.
我似乎无法找到旧名称的任何地方,howevel错误它提到它。
I cant seem to find any places with the old name, howevel in the error it mentions it.
我有这个问题已经几次,所以我会写下来,我也跟着为自己一个提醒的步骤:
I had this issue a few times already, so I will write down the procedure I follow also as a reminder for myself:
- 替换所有旧的解决方案的名称与新的。
- 导航为属性每个项目下,改变的大会名称和默认命名空间字段,以新的解决方案的名称。
- 转到解决方案文件夹,并用新的解决方案的名称重命名所有项目文件夹。
- 删除下的所有文件的斌和 OBJ 文件夹。
- 解决方案将无法加载的项目。删除所有项目并重新添加它们。
- 重新生成项目。
- Replace all of the old solution name with the new one.
- Navigate to Properties under each project and change the Assembly Name and Default Namespace fields to new solution name.
- Go to solution folder and rename all project folders with the new solution name.
- Remove all files under bin and obj folders.
- Solution will not be able to load projects. Remove all projects and add them again.
- Re-build the project.