Error renaming ASP.NET MVC project
Solution 1
I had this issue a few times already, so I will write down the procedure I follow also as a reminder for myself:
- 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.
Solution 2
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.
Solution 3
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.
Solution 4
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:
To rename it, all you need to do is add a string on the OwinStartup Like so:
[assembly: OwinStartup("ProductionConfiguration", typeof(StartupDemo.ProductionStartup2))]
Solution 5
Add following tag on web config appsetting
<appSettings>
<add key="owin:AutomaticAppStartup" value="false" />
</appSettings>
Related videos on Youtube
Zapnologica
I am an enthusiastic developer indulging in the world of programming. in love with C# .net
Updated on July 05, 2022Comments
-
Zapnologica almost 2 years
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.
-
Chris Story about 10 yearsI have the same issue. Any answers or luck figuring out the solution?
-
Zapnologica about 10 yearsI just deleted the project and started again. Only renaming the classes and namespace.
-
-
Nicolas about 10 yearsThanks. Deleting the contents of the "bin" folder was all that I needed.
-
dunwan over 9 yearsI deleted the specific DLLs referencing the original project and Boom! back in business. Thanks!
-
madvora about 9 yearsFollowed multiple renaming How-Tos and this this the one that finally worked. Thanks
-
Amadeusz Wieczorek about 9 yearsIf your website is hosted on Azure, you need to clean-publish to remove files under bin and obj folders online: stackoverflow.com/questions/17476525/…
-
Aki almost 8 yearsThe way I fixed it was by selecting the Startup class file and changing the Build Action to "Content" from "Compile".
-
StuartLC over 7 yearsThis would only work if the assembly had been renamed and both copies were still present in /bin.
-
JimiSweden over 7 yearsAnd if you are getting this error in Azure you can update the "file publish options" in your publish profile setting and check "Remove additional files at destination". "publish web/settings/file publish options". This is equvalent to deletting bin (and obj?) locally.
-
Ross over 7 yearsThanks!! Blowing away ASP.NET Temporary Files directory also helps
-
Hugo about 7 yearsAlso remove and re-add project references is required. as well as Global.asax tuneup
-
John Hogan almost 7 yearsAlso navigate to the project properties and press ctrl + H and replace all the old names with the new names
-
citronas over 5 yearsIf you are using IIS: You may also need to recycle your application pool and restart you site.