.NET Core 1.1 - 包含"重复'内容'项目"

dev*_*r82 4 compiler-errors .net-core asp.net-core asp.net-core-2.0 .net-core-2.0

我已将VS2017更新到最新的15.3.0并安装了.NET Core SDK 2.0(我想将现有的.NET 1.1应用程序升级到2.0).

现在当我打开我正在编译的项目时(它还没有改变任何内容)我尝试编译得到:

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: 'wwwroot\index.html'
Run Code Online (Sandbox Code Playgroud)

在有问题的文件下,它指向 C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets

我在线阅读,我可以通过添加<EnableDefaultContentItems>false</EnableDefaultContentItems>到我的.csproj文件来解决这个问题.但它以前不存在,我不确定添加这条线是什么意思.

一旦真正困扰我的是它指向的源文件是dotnet\sdk\2.0.0- 并且正如我所提到的,该项目仍然是.NET Core 1.1.到目前为止,我所做的就是安装VS2017和2.0 SDK的更新.

我该如何解决这个问题?在将其升级到2.0之前,我希望我的原始项目能够编译.

编辑

我的csproj档案:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="wwwroot\index.html" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="IdentityServer4" Version="1.5.2" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
    <PackageReference Include="NLog.Web.AspNetCore" Version="4.4.1" />
  </ItemGroup>
  <ItemGroup>
    <Content Update="appsettings.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Update="web.config">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <None Update="NLog.config">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>
Run Code Online (Sandbox Code Playgroud)

就好像我提到添加<EnableDefaultContentItems>false</EnableDefaultContentItems>PropertyGroup它的工作原理.但我不知道这是什么意思,或者为什么突然需要......

Mar*_*ich 6

删除<ItemGroup>包含的元素

<Content Include="wwwroot\index.html" />
Run Code Online (Sandbox Code Playgroud)

此项目已包含在内,Microsoft.NET.Sdk.Web因此定义了两次.