Upgrading my solution from Visual Studio 2017 RC to Visual Studio 2017 causes build errors about duplicate items

Errors :

C:\git\dotnet-sdk\bin\Debug\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets(66,5): error : Duplicate Compile items were included. The .NET SDK includes Compile items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultCompileItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://github.com/dotnet/sdk The duplicate items were: 'Class1.cs', 'DuplicateCompileItems.cs'

Solution :

Delete the line <Compile Include="**\*.cs" /> in all the csproj files of my project.

EDIT: A documentation page has been added to GitHub : Default Compile Item Values in the the .NET Core SDK - Visual Studio 2017 RC3

March 08, 2017
  • Visual Studio 2017
  • Duplicate Items