Tuesday, October 10, 2017

MVC Core - Duplicate Content Error after Upgrading Visual Studio 2017

Error

  • Dotnet-aspnet-codegenerator-design has stopped working
  • Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by default.
  • Failed to build the project. Please fix the build errors and retry again


Reason

The problem is a change on the RC3 release of Visual Studio 2017, if you have globs in your project and you try to build it using the newest SDK, you'll get the error. Basically your content, such as the files in wwwroot are now getting imported by the default includes that are built-in to Visual Studio and by the manual rules in your csproj file.


Solution 1

Open your web project file .csproj and remove the duplicated items specified in the error message


Basically remove the ItemGroup tag with all the wwwroot paths.



Solution 2

Open your web project file .csproj
Look for the tag
Add the next tag false


No comments:

Post a Comment