Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
104 views
in .Net Framework by 3 5

I have created new project in Visule Studio using ASP.NET Web Application (.NET Framework ) and i have made my model and created my local database but when i try to make controller it showes this ERROR


1 Answer

0 like 0 dislike
by 18 28 36

This error usually indicates that the code generator is unable to find the specified type, often due to issues in the project structure, references, or compilation errors.

Here are steps to resolve this issue:

  1. Rebuild the Project
    Go to Build > Rebuild Solution in Visual Studio. This can often resolve issues related to outdated or corrupted build files.
  2. Check the Model Class
    Ensure that the Weblist class exists in the WebApplication7.Models namespace.

  3. Resolve Compilation Errors
    Build the solution and check for any compilation errors. Fix any errors that appear, as they can prevent the code generator from running.

  4. Check References
    Ensure that all necessary references are correctly added and updated in the project. Sometimes missing or incorrect references can cause issues.

  5. Clean the Solution
    Go to Build > Clean Solution, then rebuild the solution. Cleaning the solution can remove any corrupted files.

  6. Verify Code Generation Tool
    Ensure you are using the correct code generation tool (like scaffolding tools). Sometimes switching between tools or updating them can resolve issues.

  7. Use Command Line for Scaffolding
    Try running the scaffolding command from the command line to see if it provides more detailed error messages.

`dotnet aspnet-codegenerator controller -name WeblistController -m WebApplication7.Models.Weblist -dc ApplicationDbContext --relativeFolderPath Controllers --useDefaultLayout referenceScriptLibraries`

After that, try to re-generate the View or Controller.

If you don’t ask, the answer is always NO!
...