Visual Studio “Duplicate ‘Content’ items were included” Fix

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:”

error

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.

Step1

Step 2: Exclude “wwwroot” folder from your project

Step2

Step 3: Include “wwwroot” folder in your project

Step3

That’s it!  You should be able to re-build your project now.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Advertisements
%d bloggers like this: