2

net core application that I have not opened in a month. The application worked last time I opened it but now when I try to build the project I get the following error in the Page class which is not a class from my project:

enter image description here

This are errors that gets displayed on the console:

enter image description here

This is what I have in my project.json file:

    {
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

Anyone know what is wrong here?

2
  • try to delete project.lock.json and restore dependencies again Commented Sep 2, 2016 at 14:21
  • There's no WebForms in ASP.NET Core. Only MVC/WebApi. Not sure why it was compiling before! Commented Sep 2, 2016 at 16:56

3 Answers 3

3

You need to go to node_modules and manually delete Page.aspx.cs and all .cs files. Selenium-webdriver contains a test folder with it. I have had the same problem. Be sure to show all files so you will see the node modules folder

Sign up to request clarification or add additional context in comments.

Comments

2

Not sure how it could work before. You can't use System.Web/WebForms with ASP.NET Core.

2 Comments

I have not added system.web that is the weird thing
@aleczandru - You have the Page that derives from System.Web.UI.Page. If it was not there before someone had to add it and in that case you should be fine if you just remove it since it could never work.
0

That will not work the way you think. When you use .Net Core MVC or.Net Core 2 MVC against the full framework (ASP .Net MVC) it's true that the System.Web namespace exists and could technically be called but it won't work like you want.

Solution - In the Solution Explorer, right click on the node_modules folder and click "Exclude From Project"

Precaution - Do not delete any file inside node_modules or folder itself.

Reason - If you are working on a client side app that includes npm and node_module folders with large amount of dependencies while using website project in Visual Studio, which is a terrible solution.It results in very slow load times and/or file load errors.

If you have a node_modules folder in your project it will affect the files in the project as well as for publishing. Finally, using a node_modules massive folder in your project there is no way to limit files or folders and end up giving errors.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.