dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.22k stars 1.35k forks source link

Duplicate 'Content' items error when building asp.net core projects in VS 2017 RC #1629

Closed Gorthog closed 7 years ago

Gorthog commented 7 years ago

Repro:

  1. Create new project ASP.NET Core Web Application.
  2. Pick ASP.NET Core Web API 1.0.
  3. in csproj, paste the following packages

    
    
    <PackageReference Include="AutoMapper" Version="5.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Cors" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="1.1.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0-preview4-final" />
    <PackageReference Include="Microsoft.NET.Sdk.Web" Version="1.0.0-alpha-20161104-2-112" />
    <PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
    <PackageReference Include="NLog.Extensions.Logging" Version="1.0.0-rtm-alpha5" />
    <PackageReference Include="Shaman.EPPlus" Version="1.0.1.1" />
    <PackageReference Include="Swashbuckle" Version="6.0.0-beta902" />
    <PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.6.9" />

4. rebuild

expected: 
build succeeds. 

actual:
build fails with:

Severity    Code    Description Project File    Line    Suppression State
Error       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. The duplicate items were: 'web.config'; 'appsettings.Development.json'; 'appsettings.json'; 'Properties\launchSettings.json'; 'runtimeconfig.template.json'    WebApplication1 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets  188 
jeffkl commented 7 years ago

This should be moved to the https://github.com/dotnet/sdk repo.

This error check was introduced at https://github.com/dotnet/sdk/pull/624. @dsplaisted Are the duplicates being caused by package refs?

dsplaisted commented 7 years ago

Moved to https://github.com/dotnet/sdk/issues/758