Error renaming an ASP.NET MVC project

I copied the previous project and renamed it. Once I have successfully renamed all namespaces and built it correctly. When I started the application, I received the following error:

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 found out that if I comment on the first line below, the error will disappear.

 //[assembly: OwinStartupAttribute(typeof(Service_Monitor_Web_Interface.Startup))] namespace Service_Monitor_Web_Interface { public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); } } } 

I renamed my solution from User_Manager_Interface to Service_Monitor_Web_Interface.

It seems that I can not find places with the old name, howwvel in the error that he mentions.

+69
asp.net-mvc asp.net-mvc-5 owin asp.net-authentication
Feb 11 '14 at 12:02
source share
7 answers

I had this problem several times, so I will write down the procedure that I am following, as well as a reminder for myself:

  • Replace all previous solution name with a new one.
  • Go to Properties in each project and change the Assembly name and Default namespace fields for the new solution name.
  • Go to the solutions folder and rename all project folders with the new solution name.
  • Delete all the files in the bin and obj folders.
  • The solution will not be able to download projects. Delete all projects and add them again.
  • Restore the project.
+147
Mar 05 '14 at 14:30
source share

This problem occurs if you have two assemblies in the same bin folder that contain the OwinStartup class. Normally, you should not have two OwinStartup classes for the same web application.

You can solve this problem by checking the bin folder. If after renaming the assembly with the old name remains in the bin folder, you will get this error. To solve the problem, delete everything from the bin folder.

+29
Oct 03 '14 at 9:01
source share

I had the same problem after renaming the solution assembly.

I decided that OwinStartupAttritbute refers to my new assembly name.

Next, delete the old assembly found in the bin folder.

+12
Mar 04 '14 at 3:00
source share

I did not rename my solution, but I ran into this problem. I could not find a solution posted anywhere. I had two separate projects with the owin startup class on the same server. I simply gave each other a “Friendly Name”, as suggested in the exception message, and resolved it. I found a good article about this:

Owin launch class

To rename it, all you have to do is add a line to OwinStartup. So:

[assembly: OwinStartup ("ProductionConfiguration", typeof (StartupDemo.ProductionStartup2))]

+8
Jul 13 '14 at 3:41
source share

Add the following tag to your web configuration

 <appSettings> <add key="owin:AutomaticAppStartup" value="false" /> </appSettings> 
+1
Feb 21 '17 at 13:47 on
source share
0
Mar 30 '16 at 8:47
source share

I have two ASP.NET MVC 5 projects, Project1 and Project2.

The problem is that the DLL of the two projects is in the same bin folder and both use Owin middleware. This means that Project1.dll and Project2.dll exist in the same bin folder of Project2.

Since I only need one of them in each project, I simply delete the unused Project1.dll file in the bin folder of the Project2 project.

0
Mar 08 '17 at 10:22
source share



All Articles