VS2017を最新の15.3.0にアップデートし、.NET Core SDK 2.0をインストールしました(既存の.NET 1.1アプリケーションを2.0にアップグレードしたい)。私は罰金をコンパイルした私のプロジェクトを開いたときに.NET Core 1.1 - Duplicate 'Content'アイテムが含まれていました
今(まだそれには何も変更していない)と私は私が手コンパイルしよう:
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'
問題のファイルの下にそれがC:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets
を指しています私はオンラインで読んだので、私は.csproj
ファイルに<EnableDefaultContentItems>false</EnableDefaultContentItems>
を加えることでこれを解決することができます。しかしそれは以前にはなかったし、私はこのラインを加えることが何を意味するのか分からない。
本当に気になることは、それが指しているソースファイルがdotnet\sdk\2.0.0
であり、プロジェクトが.NET Core 1.1であるということです。 VS2017と2.0 SDKのアップデートをインストールするだけでした。
どうすれば解決できますか? 2.0にアップグレードする前に私の元のプロジェクトをコンパイルしたいと思います。
EDIT
マイ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>
述べたように、私はPropertyGroup
に<EnableDefaultContentItems>false</EnableDefaultContentItems>
を追加する場合、それは動作します。しかし、私はこれの意味が何であるかを知らないか、それが突然のすべてを必要としている理由...
これはcsprojファイルの問題です。私たちがあなたを助けるために共有する必要があります。 –
@MartinUllrichが私の質問を編集しました – developer82