Error renaming ASP.NET MVC project

前端 未结 7 874
慢半拍i
慢半拍i 2021-01-30 09:54

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

相关标签:
7条回答
  • 2021-01-30 10:28

    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.

    0 讨论(0)
  • 2021-01-30 10:29

    Just cleanup the solution, it should do the trick ;)

    0 讨论(0)
  • 2021-01-30 10:31

    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.

    0 讨论(0)
  • 2021-01-30 10:32

    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.
    0 讨论(0)
  • 2021-01-30 10:34

    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.

    0 讨论(0)
  • 2021-01-30 10:36

    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))]

    0 讨论(0)
提交回复
热议问题