Unable to load type'<Projectname>. Mvcapplication 'when duplicating project

Asked

Viewed 1,167 times

0

I duplicated my project in Visual Studio as follows:

1° I entered the filesystem and gave CTRL C + V in the briefcase SiteTeste which is the project folder.

2° I renamed the folder to Siteteste2 and then renamed the files .csproj,.csproj.user and .user was like this: inserir a descrição da imagem aqui

3° I changed the file Global.asax being like this:

<%@ Application Codebehind="Global.asax.cs" Inherits="Siteteste2.MvcApplication" Language="C#" %>

3° I added the project through Visual Studio, and it was added inside the file .sln being like this:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiteTeste", "SiteTeste\SiteTeste.csproj", "{0DAAF99F-D5F0-47C7-B1CC-E042F0C5C3AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Siteteste2", "Siteteste2\Siteteste2.csproj", "{8F4DD610-3480-4B5D-AB6C-1538D4182C43}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {0DAAF99F-D5F0-47C7-B1CC-E042F0C5C3AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {0DAAF99F-D5F0-47C7-B1CC-E042F0C5C3AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {0DAAF99F-D5F0-47C7-B1CC-E042F0C5C3AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {0DAAF99F-D5F0-47C7-B1CC-E042F0C5C3AC}.Release|Any CPU.Build.0 = Release|Any CPU        
        {8F4DD610-3480-4B5D-AB6C-1538D4182C43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {8F4DD610-3480-4B5D-AB6C-1538D4182C43}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {8F4DD610-3480-4B5D-AB6C-1538D4182C43}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {8F4DD610-3480-4B5D-AB6C-1538D4182C43}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {05F0005B-FC82-4B57-BAE6-9FA284547CA5}
    EndGlobalSection
    GlobalSection(Performance) = preSolution
        HasPerformanceSessions = true
    EndGlobalSection
EndGlobal

Until then ok, but when I go to run any of the projects I get this error:

inserir a descrição da imagem aqui

EDIT:

I changed the namespace of global.asax.cs and ends up causing these mistakes: inserir a descrição da imagem aqui

And when I hover over the bug, it asks me to add using SiteTeste

  • Enter the global.asax code and see the namespace.

1 answer

2


Open the Global.asax.Cs file and fix the namespace to be in line with what is in Global.asax

namespace Siteteste2
{
    public class MvcApplication : System.Web.MvcApplication
    {
        protected void Application_Start()
        {              
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            AuthConfig.RegisterAuth();

        }
    }
}

Also change the namespace of the classes WebApiConfig,FilterConfig and RouteConfig.

  • LINQ, I did it,at first I thought it would fix, but it ended up causing some errors, check out my EDIT.

  • Just do the usings, man

  • using Siteteste (source project)? because it is only this option that it gives me

  • LINQ failed to change the namespace of the classes within the global, I edited his reply and added this information ok ? It worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.