79
votes

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);
    }
}
}

I renamed my solution from User_Manager_Interface to Service_Monitor_Web_Interface.

I cant seem to find any places with the old name, howevel in the error it mentions it.

7
I have the same issue. Any answers or luck figuring out the solution?Chris Story
I just deleted the project and started again. Only renaming the classes and namespace.Zapnologica

7 Answers

174
votes

I had this issue a few times already, so I will write down the procedure I follow also as a reminder for myself:

  1. Replace all of the old solution name with the new one.
  2. Navigate to Properties under each project and change the Assembly Name and Default Namespace fields to new solution name.
  3. Go to solution folder and rename all project folders with the new solution name.
  4. Remove all files under bin and obj folders.
  5. Solution will not be able to load projects. Remove all projects and add them again.
  6. Re-build the project.
31
votes

This problem will occur if you have two assemblies in the same bin folder which contain an OwinStartup class. Normally you should not have two OwinStartup classes for the same web application.

You can solve this by inspecting your bin folder. If after the rename an assembly with the old name has remained in the bin folder you will get this error. To solve it delete everything from the bin folder.

12
votes

I was having the same problem after renaming the assembly of the solution.

I solved by making sure the OwinStartupAttritbute is refering to my new assembly name.

Next is to delete the old assembly found in bin folder.

8
votes

I did not rename my solution, but I did run into this problem. I couldnt find a solution posted anywhere about this. I had 2 separate projects with an owin startup class on the same server. I simply gave each one a different "Friendly Name" as suggested in the exception message, and it solved it. I found a good article on this:

Owin Startup Class

To rename it, all you need to do is add a string on the OwinStartup Like so:

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

3
votes

Add following tag on web config appsetting

<appSettings>
   <add key="owin:AutomaticAppStartup" value="false" />   
</appSettings>
1
votes

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

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

Since I only need one of them in each of the project, so I just remove the unused Project1.dll in Project2 bin folder.