Recently migrated a project from one machine to another. Original machine was running Visual Studio 2015 Professional, and the new machine Visual Studio 2017 Professional. Once I grabbed the source code from our Git repo I could not longer build the project. When I tried I received this error within Visual Studio:
“Duplicate ‘Content’ items were included. The .NET SDK includes ‘Content’ items from your project directory by default. You can either remove these items from your project file, or set the ‘EnableDefaultContentItems’ property to ‘false’ if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were:”
There is an easy fix though! Shorthand is, just “exclude” then “include” your “wwwroot” directory. This will make the necessary changes to your project. I included step by step instructions below.
Step 1: Show all files in Visual Studio
Within in Visual Studio, inside your Solution Explorer tab you’ll want to enable “Show All Files”. This will help you re-include the “wwwroot” directory later on.
Step 2: Exclude “wwwroot” folder from your project
Step 3: Include “wwwroot” folder in your project
That’s it! You should be able to re-build your project now.