Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by...












94














Whenever I add a javascript or css file to my asp.net core project and I execute dotnet run in my bash terminal, I get the following error:




/usr/share/dotnet/sdk/1.0.1/Sdks/Microsoft.NET.Sdk/build/Microsoft



.NET.Sdk.DefaultItems.targets(188,5): 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.
For more information, see https://aka.ms/sdkimplicititems. The
duplicate items were: 'wwwroot/css/BasicQuotation.css';
'wwwroot/js/BasicQuotation.js'
[/mnt/c/Dev/myproject/MyProject/MyProject.csproj]



The build failed. Please fix the build errors and run again.




I can fix this by removing the ItemGroup from my csproj file, but I don't think that's very productive.



This happens in the default Visual Studio 2017 ASP.NET Core Web Application (.NET Core) template. I add the files to my project by right clicking the wwwroot > js folder and then select Add > New Item > JavaScript File



This is my .csproj file:



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

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

<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>

<PropertyGroup>
<UserSecretsId>aspnet-MyProject-7e1906d8-5dbd-469a-b237-d7a563081253</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<Compile Remove="wwwrootlibjquery-validation**" />
<Content Remove="wwwrootlibjquery-validation**" />
<EmbeddedResource Remove="wwwrootlibjquery-validation**" />
<None Remove="wwwrootlibjquery-validation**" />
</ItemGroup>

<ItemGroup>
<Content Include="wwwrootcssBasicQuotation.css" />
<Content Include="wwwrootjsBasicQuotation.js" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="DataCommands" />
<Folder Include="DataQueries" />
<Folder Include="wwwrootimages" />
</ItemGroup>

</Project>









share|improve this question


















  • 13




    If you are running into this problem after updating VS2017 to v15.3, make sure you take a look here. MS decided to include certain folders such as wwwroot by default now, which means they probably are included twice.
    – jao
    Aug 17 '17 at 6:17












  • The article that @jao shared, explains very well why this happens and how to fix it. Just go straight to that article.
    – Pepito Fernandez
    Aug 28 '17 at 15:11
















94














Whenever I add a javascript or css file to my asp.net core project and I execute dotnet run in my bash terminal, I get the following error:




/usr/share/dotnet/sdk/1.0.1/Sdks/Microsoft.NET.Sdk/build/Microsoft



.NET.Sdk.DefaultItems.targets(188,5): 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.
For more information, see https://aka.ms/sdkimplicititems. The
duplicate items were: 'wwwroot/css/BasicQuotation.css';
'wwwroot/js/BasicQuotation.js'
[/mnt/c/Dev/myproject/MyProject/MyProject.csproj]



The build failed. Please fix the build errors and run again.




I can fix this by removing the ItemGroup from my csproj file, but I don't think that's very productive.



This happens in the default Visual Studio 2017 ASP.NET Core Web Application (.NET Core) template. I add the files to my project by right clicking the wwwroot > js folder and then select Add > New Item > JavaScript File



This is my .csproj file:



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

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

<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>

<PropertyGroup>
<UserSecretsId>aspnet-MyProject-7e1906d8-5dbd-469a-b237-d7a563081253</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<Compile Remove="wwwrootlibjquery-validation**" />
<Content Remove="wwwrootlibjquery-validation**" />
<EmbeddedResource Remove="wwwrootlibjquery-validation**" />
<None Remove="wwwrootlibjquery-validation**" />
</ItemGroup>

<ItemGroup>
<Content Include="wwwrootcssBasicQuotation.css" />
<Content Include="wwwrootjsBasicQuotation.js" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="DataCommands" />
<Folder Include="DataQueries" />
<Folder Include="wwwrootimages" />
</ItemGroup>

</Project>









share|improve this question


















  • 13




    If you are running into this problem after updating VS2017 to v15.3, make sure you take a look here. MS decided to include certain folders such as wwwroot by default now, which means they probably are included twice.
    – jao
    Aug 17 '17 at 6:17












  • The article that @jao shared, explains very well why this happens and how to fix it. Just go straight to that article.
    – Pepito Fernandez
    Aug 28 '17 at 15:11














94












94








94


16





Whenever I add a javascript or css file to my asp.net core project and I execute dotnet run in my bash terminal, I get the following error:




/usr/share/dotnet/sdk/1.0.1/Sdks/Microsoft.NET.Sdk/build/Microsoft



.NET.Sdk.DefaultItems.targets(188,5): 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.
For more information, see https://aka.ms/sdkimplicititems. The
duplicate items were: 'wwwroot/css/BasicQuotation.css';
'wwwroot/js/BasicQuotation.js'
[/mnt/c/Dev/myproject/MyProject/MyProject.csproj]



The build failed. Please fix the build errors and run again.




I can fix this by removing the ItemGroup from my csproj file, but I don't think that's very productive.



This happens in the default Visual Studio 2017 ASP.NET Core Web Application (.NET Core) template. I add the files to my project by right clicking the wwwroot > js folder and then select Add > New Item > JavaScript File



This is my .csproj file:



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

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

<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>

<PropertyGroup>
<UserSecretsId>aspnet-MyProject-7e1906d8-5dbd-469a-b237-d7a563081253</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<Compile Remove="wwwrootlibjquery-validation**" />
<Content Remove="wwwrootlibjquery-validation**" />
<EmbeddedResource Remove="wwwrootlibjquery-validation**" />
<None Remove="wwwrootlibjquery-validation**" />
</ItemGroup>

<ItemGroup>
<Content Include="wwwrootcssBasicQuotation.css" />
<Content Include="wwwrootjsBasicQuotation.js" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="DataCommands" />
<Folder Include="DataQueries" />
<Folder Include="wwwrootimages" />
</ItemGroup>

</Project>









share|improve this question













Whenever I add a javascript or css file to my asp.net core project and I execute dotnet run in my bash terminal, I get the following error:




/usr/share/dotnet/sdk/1.0.1/Sdks/Microsoft.NET.Sdk/build/Microsoft



.NET.Sdk.DefaultItems.targets(188,5): 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.
For more information, see https://aka.ms/sdkimplicititems. The
duplicate items were: 'wwwroot/css/BasicQuotation.css';
'wwwroot/js/BasicQuotation.js'
[/mnt/c/Dev/myproject/MyProject/MyProject.csproj]



The build failed. Please fix the build errors and run again.




I can fix this by removing the ItemGroup from my csproj file, but I don't think that's very productive.



This happens in the default Visual Studio 2017 ASP.NET Core Web Application (.NET Core) template. I add the files to my project by right clicking the wwwroot > js folder and then select Add > New Item > JavaScript File



This is my .csproj file:



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

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

<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>

<PropertyGroup>
<UserSecretsId>aspnet-MyProject-7e1906d8-5dbd-469a-b237-d7a563081253</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<Compile Remove="wwwrootlibjquery-validation**" />
<Content Remove="wwwrootlibjquery-validation**" />
<EmbeddedResource Remove="wwwrootlibjquery-validation**" />
<None Remove="wwwrootlibjquery-validation**" />
</ItemGroup>

<ItemGroup>
<Content Include="wwwrootcssBasicQuotation.css" />
<Content Include="wwwrootjsBasicQuotation.js" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="DataCommands" />
<Folder Include="DataQueries" />
<Folder Include="wwwrootimages" />
</ItemGroup>

</Project>






asp.net asp.net-core asp.net-core-mvc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 10 '17 at 14:30









jao

12.7k114790




12.7k114790








  • 13




    If you are running into this problem after updating VS2017 to v15.3, make sure you take a look here. MS decided to include certain folders such as wwwroot by default now, which means they probably are included twice.
    – jao
    Aug 17 '17 at 6:17












  • The article that @jao shared, explains very well why this happens and how to fix it. Just go straight to that article.
    – Pepito Fernandez
    Aug 28 '17 at 15:11














  • 13




    If you are running into this problem after updating VS2017 to v15.3, make sure you take a look here. MS decided to include certain folders such as wwwroot by default now, which means they probably are included twice.
    – jao
    Aug 17 '17 at 6:17












  • The article that @jao shared, explains very well why this happens and how to fix it. Just go straight to that article.
    – Pepito Fernandez
    Aug 28 '17 at 15:11








13




13




If you are running into this problem after updating VS2017 to v15.3, make sure you take a look here. MS decided to include certain folders such as wwwroot by default now, which means they probably are included twice.
– jao
Aug 17 '17 at 6:17






If you are running into this problem after updating VS2017 to v15.3, make sure you take a look here. MS decided to include certain folders such as wwwroot by default now, which means they probably are included twice.
– jao
Aug 17 '17 at 6:17














The article that @jao shared, explains very well why this happens and how to fix it. Just go straight to that article.
– Pepito Fernandez
Aug 28 '17 at 15:11




The article that @jao shared, explains very well why this happens and how to fix it. Just go straight to that article.
– Pepito Fernandez
Aug 28 '17 at 15:11












16 Answers
16






active

oldest

votes


















91














So I ran into this same issue. I didn't want to turn off DefaultCompileItems because I knew that wouldn't "fix" the problem. So I unloaded my project and opened the .csproj file in text mode in Visual Studio and saw this.



<ItemGroup>
<Content Include="wwwrootcsscustom-bootstrap-navbar.css" />
<Content Include="wwwrootimagesfriends-eatingimage1.jpg" />
<Content Include="wwwrootimagesfriends-eatingimage2.jpg" />
<Content Include="wwwrootimagesfriends-eatingimage3.jpg" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwrootimagesfriends-eating" />
</ItemGroup>


When I commented out the first ItemGroup block, it worked. What I assume is happening is that the project is adding the entire imagesfriends-eating folder and then adding each individual image, causing a duplication.



As far as the custom css and js, the project automatically adds wwwrootcss and wwwrootjs so if you have an individual file added (like wwwrootcsscustom-bootstrap-navbar.css) it'll count as a duplicate.






share|improve this answer























  • This <Folder Include="wwwroot" /> works for me, but visual studio undo that later on :(
    – Jaider
    Oct 1 '17 at 12:59





















159















  1. Click 'Show All Files' in Solution Explorer

  2. Right click over 'wwwroot' select 'Exclude From Project'

  3. Right click over 'wwwroot' select 'Include in Project'






share|improve this answer

















  • 2




    Doing this solved the problem for me, but what actually happened to make it work?
    – Rono
    Aug 30 '17 at 14:49










  • @Rono Looks like it explicitly identifies all the files in your wwwroot file in the .csproj file. eg: i.imgur.com/4SPnQ5h.png
    – J. Schei
    Sep 1 '17 at 20:18








  • 4




    Worked for me as well - and a far more safe way to go in my opinion than the accepted answer.
    – brinch
    Sep 12 '17 at 6:09












  • It worked for me too! Disabling DefaultContentItems helped build my solution, but images, CSSs and other files were not showing.
    – BrunoSerrano
    Sep 14 '17 at 17:01










  • Works! You might have to close and re-open the Solution Explorer in order to make the wwwroot folder visible again after step 2.
    – Lorentz
    Sep 21 '17 at 13:45



















21














This worked in my case:



 <PropertyGroup>
...
<EnableDefaultContentItems>false</EnableDefaultContentItems>
</PropertyGroup>





share|improve this answer

















  • 2




    As stated in my comment to Pinki's answer, I would not propose this as solution as this could lead to more errors.
    – Matt
    Aug 15 '17 at 14:53










  • I actually ran into bigger problems setting this option to false. I would also recommend not setting it to false.
    – Rwiti
    Dec 7 '17 at 18:47





















12














It happend when I upgrade my project from .NET Core 1.X to 2.0 just now. Here is my solution.




  • Open xxx.csproj, or right click project

  • Unload Project

  • Edit xxx.csproj.


Then remove ItemGroup items start with <Content Include = "wwwrootxxxxx"






share|improve this answer























  • Thanks! Note: It seems to be related to latest Visual Studio version 15.3, not directly to .NET Core 2.0
    – Vincent V.
    Aug 21 '17 at 8:29



















10














My issues was close but not the exact same. My error was this:




C:Program Filesdotnetsdk2.0.0-preview2-006497SdksMicrosoft.NET.SdkbuildMicrosoft.NET.Sdk.DefaultItems.targets(285,5): 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. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js' [C:Avantia ProjectsTime Cardavantia-timesheetSolutionAlmanacAlmanac.csproj]




If I did this:



<EnableDefaultContentItems>false</EnableDefaultContentItems>


It would not compile as all of the sudden Areas would not be recognized.



My solution, seems odd, but the message is telling me so, there were duplicate files:




The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js'




Looking at my .csproj file:



<ItemGroup>
<Content Include="pdf.js" />
<Content Include="wwwrootjspackage.json" />
<Content Include="wwwrootjspdf.js" />
<Content Include="wwwrootjsKOBindings.js" />
<Content Include="wwwrootjsKOPleaseWait.js" />
<Content Include="wwwrootjsProjectTimeAdd.js" />
<Content Include="wwwrootjsTimeAdminInvoice.js" />
<Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
</ItemGroup>


This was the ONLY location within the entire project where these files were references (aside from where they were loaded.) So the phrase duplicate does not make any sense to me. However, commenting those files out as such, took care of my problem:



<ItemGroup>
<Content Include="pdf.js" />
<Content Include="wwwrootjspackage.json" />
<Content Include="wwwrootjspdf.js" />
<!--
<Content Include="wwwrootjsKOBindings.js" />
<Content Include="wwwrootjsKOPleaseWait.js" />
<Content Include="wwwrootjsProjectTimeAdd.js" />
<Content Include="wwwrootjsTimeAdminInvoice.js" />
<Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
-->
</ItemGroup>


I assume this has something to do with the 2.0.0-preview2-006497 that I recently installed.



Also, this link mentions talks about globs. But does not tell me where that is. It talks about SDKs and such. Yet the answer was my custom .js files. That link needs to be updated or expanded on IMHO. Hope this helps someone.






share|improve this answer





















  • Would love to know why this works. However, just worked for me. =)
    – Frog Pr1nce
    Aug 31 '17 at 18:10



















6














As link says, you can disable this behavior (auto-include) and include all content explicitly by adding this into your csproj file:



<PropertyGroup>
<EnableDefaultContentItems>false</EnableDefaultContentItems>
</PropertyGroup>





share|improve this answer



















  • 1




    When I add that to my csproj file and I remove the css/js itemgroup, I get the following error: CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/mnt/c/Dev/myproject/MyProject/MyProject.csproj] The build failed. Please fix the build errors and run again.
    – jao
    Apr 10 '17 at 16:49






  • 2




    "Content" not "Compile" - Doesn't it?
    – harveyt
    Jun 5 '17 at 3:47










  • Of course "Content". My bad. Fixed. Thank you.
    – Dmitry
    Aug 17 '17 at 8:03










  • One side note....if you don't explicitly include your Views folder, it won't publish your views with this setting
    – saluce
    Aug 21 '17 at 19:02










  • I tried this but it didn't work. still getting the same error
    – pantonis
    Aug 31 '17 at 6:34





















2














In my case, I solved this by deleting all files from the wwwroot-Directory in VS.
Unload and reload the Project.
Copy all files back in with VS.
Done






share|improve this answer





















  • None of the top solutions worked for me I did this before reading your comment and this works flawless!!! I excluded the wwwroot, controllers, views folders and added them back and now everything works fine!
    – revobtz
    Aug 16 '17 at 19:09



















2














Actually, Asp.net core automatically include content from wwwrootcss , wwwrootjs and wwwrootlib location, so despite this if your csproj file explicitly include content from those directories then those content will be duplicated so removing content from you csproj file is the better way to get rid of this error. So remove below content-



  <ItemGroup>
<Compile Remove="wwwrootlibjquery-validation**" />
<Content Remove="wwwrootlibjquery-validation**" />
<EmbeddedResource Remove="wwwrootlibjquery-validation**" />
<None Remove="wwwrootlibjquery-validation**" />
</ItemGroup>

<ItemGroup>
<Content Include="wwwrootcssBasicQuotation.css" />
<Content Include="wwwrootjsBasicQuotation.js" />
</ItemGroup>





share|improve this answer

















  • 1




    This happened to me on updating Visual Studio to 15.3. To prevent breaking changes to my colleagues who have not updated yet, I had to add <PropertyGroup> <EnableDefaultContentItems>false</EnableDefaultContentItems> </PropertyGroup> to the .csproj file.
    – saluce
    Aug 17 '17 at 18:41










  • @saluce yes you are right, the same solution you can use in your context too. the choice is based on the developer whether he wants to keep EnableDefaultContentItems or not. They are two different approach
    – Mostafiz
    Aug 18 '17 at 8:48










  • My point was that the only change I made was upgrading Visual Studio to 15.3. I made no changes to my project, but prior to the upgrade, this setting was not required.
    – saluce
    Aug 19 '17 at 21:25



















1














Not that I can see it in your example above, to help other SO searchers..



You can also get this error when you have the same file listed twice in <Content Include="xxx" /> elements in your csproj file.



Remove the duplicate and rebuild.






share|improve this answer





























    1














    Under Visual Studio 2017 15.3, with .NET Core 2.0,
    EnableDefaultCompileItems did not work for me.



    I needed to add this to my .csproj



      <PropertyGroup>
    <EnableDefaultContentItems>false</EnableDefaultContentItems>
    </PropertyGroup>





    share|improve this answer























    • For me (visual studio 15.3.4 .NET framework 4.5.2) EnableDefaultContentItems did not work while EnableDefaultCompileItems did.
      – hlovdal
      Sep 13 '17 at 12:00



















    1














    I found a different proper solution.




    1. Right click on your mvc project and click Edit csproj.

    2. If you are adding files under wwwroot, just move them to a folder under wwwroot, let's say it "theme"


    And delete all content tags in csproj file if their exists, an example;



    <Content Include="wwwrootthemefavicon.ico" />
    <Content Include="wwwrootthemefontscyrillic-ext400.woff2" />
    <Content Include="wwwrootthemefontscyrillic-ext700.woff2" />


    And only add this;



      <ItemGroup>
    <Folder Include="wwwroottheme" />
    </ItemGroup>


    So, csproj file should be look like this;



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

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

    <PropertyGroup>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
    </PropertyGroup>

    <ItemGroup>
    <Folder Include="wwwroottheme" />
    </ItemGroup>
    <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    ...


    With that way, I think you are adding all files under theme folder. So not include them one by one which occours some erros.






    share|improve this answer





























      0














      Excluding and Including back the folders that have duplicates error worked for me! Hope this helps someone else!






      share|improve this answer





























        0














        I think what disabling "EnableDefaultContentItems" isn't the best option.
        Manual cs-Proj file editing also isn't the good idea at all.



        So for our build server pipeline, we wrote very small tool what will remove all duplicated entries automatically:
        dotnet-csproj-cleaner



        We run it under Docker as the first build step in our continuous integration pipeline.






        share|improve this answer































          0














          .NET Core Projects



          If you are in a class library, probably you'll need to remove all Compile/Content elements from your csproj as those are included automatically.



          <Project Sdk="Microsoft.NET.Sdk">    
          <PropertyGroup>
          <TargetFramework>netcoreapp2.0</TargetFramework>
          </PropertyGroup>
          <!-- NEEDED -->
          <ItemGroup>
          <ProjectReference />
          <ProjectReference />
          </ItemGroup>
          <!-- NOT NEEDED -->
          <ItemGroup>
          <Compile Include="ModelsExampleClass.cs" />
          <Content ... />
          </ItemGroup>
          </Project>





          share|improve this answer





























            0














            I had the same problem with only a file, and all others were working (all my templates were stored directly in wwwroot/content). The project was not created by me so I don't know many details.



            The problem was fixed by renaming back and forth the file with the issue:



            MyTemplate.html -- renamed --> MyTemplate2.html -- renamed --> MyTemplate.html



            Note: At the first rename I got an error with something along the lines of "content configuration not found", but the second rename worked without issues.



            After this I was able to compile the project successfully.






            share|improve this answer





























              0














              My case I is disable bot below default items.



              <EnableDefaultContentItems>false</EnableDefaultContentItems>
              <EnableDefaultItems>false</EnableDefaultItems>





              share|improve this answer





















                Your Answer






                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "1"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43325916%2fduplicate-content-items-were-included-the-net-sdk-includes-content-items-f%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                16 Answers
                16






                active

                oldest

                votes








                16 Answers
                16






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                91














                So I ran into this same issue. I didn't want to turn off DefaultCompileItems because I knew that wouldn't "fix" the problem. So I unloaded my project and opened the .csproj file in text mode in Visual Studio and saw this.



                <ItemGroup>
                <Content Include="wwwrootcsscustom-bootstrap-navbar.css" />
                <Content Include="wwwrootimagesfriends-eatingimage1.jpg" />
                <Content Include="wwwrootimagesfriends-eatingimage2.jpg" />
                <Content Include="wwwrootimagesfriends-eatingimage3.jpg" />
                </ItemGroup>
                <ItemGroup>
                <Folder Include="wwwrootimagesfriends-eating" />
                </ItemGroup>


                When I commented out the first ItemGroup block, it worked. What I assume is happening is that the project is adding the entire imagesfriends-eating folder and then adding each individual image, causing a duplication.



                As far as the custom css and js, the project automatically adds wwwrootcss and wwwrootjs so if you have an individual file added (like wwwrootcsscustom-bootstrap-navbar.css) it'll count as a duplicate.






                share|improve this answer























                • This <Folder Include="wwwroot" /> works for me, but visual studio undo that later on :(
                  – Jaider
                  Oct 1 '17 at 12:59


















                91














                So I ran into this same issue. I didn't want to turn off DefaultCompileItems because I knew that wouldn't "fix" the problem. So I unloaded my project and opened the .csproj file in text mode in Visual Studio and saw this.



                <ItemGroup>
                <Content Include="wwwrootcsscustom-bootstrap-navbar.css" />
                <Content Include="wwwrootimagesfriends-eatingimage1.jpg" />
                <Content Include="wwwrootimagesfriends-eatingimage2.jpg" />
                <Content Include="wwwrootimagesfriends-eatingimage3.jpg" />
                </ItemGroup>
                <ItemGroup>
                <Folder Include="wwwrootimagesfriends-eating" />
                </ItemGroup>


                When I commented out the first ItemGroup block, it worked. What I assume is happening is that the project is adding the entire imagesfriends-eating folder and then adding each individual image, causing a duplication.



                As far as the custom css and js, the project automatically adds wwwrootcss and wwwrootjs so if you have an individual file added (like wwwrootcsscustom-bootstrap-navbar.css) it'll count as a duplicate.






                share|improve this answer























                • This <Folder Include="wwwroot" /> works for me, but visual studio undo that later on :(
                  – Jaider
                  Oct 1 '17 at 12:59
















                91












                91








                91






                So I ran into this same issue. I didn't want to turn off DefaultCompileItems because I knew that wouldn't "fix" the problem. So I unloaded my project and opened the .csproj file in text mode in Visual Studio and saw this.



                <ItemGroup>
                <Content Include="wwwrootcsscustom-bootstrap-navbar.css" />
                <Content Include="wwwrootimagesfriends-eatingimage1.jpg" />
                <Content Include="wwwrootimagesfriends-eatingimage2.jpg" />
                <Content Include="wwwrootimagesfriends-eatingimage3.jpg" />
                </ItemGroup>
                <ItemGroup>
                <Folder Include="wwwrootimagesfriends-eating" />
                </ItemGroup>


                When I commented out the first ItemGroup block, it worked. What I assume is happening is that the project is adding the entire imagesfriends-eating folder and then adding each individual image, causing a duplication.



                As far as the custom css and js, the project automatically adds wwwrootcss and wwwrootjs so if you have an individual file added (like wwwrootcsscustom-bootstrap-navbar.css) it'll count as a duplicate.






                share|improve this answer














                So I ran into this same issue. I didn't want to turn off DefaultCompileItems because I knew that wouldn't "fix" the problem. So I unloaded my project and opened the .csproj file in text mode in Visual Studio and saw this.



                <ItemGroup>
                <Content Include="wwwrootcsscustom-bootstrap-navbar.css" />
                <Content Include="wwwrootimagesfriends-eatingimage1.jpg" />
                <Content Include="wwwrootimagesfriends-eatingimage2.jpg" />
                <Content Include="wwwrootimagesfriends-eatingimage3.jpg" />
                </ItemGroup>
                <ItemGroup>
                <Folder Include="wwwrootimagesfriends-eating" />
                </ItemGroup>


                When I commented out the first ItemGroup block, it worked. What I assume is happening is that the project is adding the entire imagesfriends-eating folder and then adding each individual image, causing a duplication.



                As far as the custom css and js, the project automatically adds wwwrootcss and wwwrootjs so if you have an individual file added (like wwwrootcsscustom-bootstrap-navbar.css) it'll count as a duplicate.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Aug 15 '17 at 19:00

























                answered Jul 9 '17 at 5:15









                Pinski

                1,43211221




                1,43211221












                • This <Folder Include="wwwroot" /> works for me, but visual studio undo that later on :(
                  – Jaider
                  Oct 1 '17 at 12:59




















                • This <Folder Include="wwwroot" /> works for me, but visual studio undo that later on :(
                  – Jaider
                  Oct 1 '17 at 12:59


















                This <Folder Include="wwwroot" /> works for me, but visual studio undo that later on :(
                – Jaider
                Oct 1 '17 at 12:59






                This <Folder Include="wwwroot" /> works for me, but visual studio undo that later on :(
                – Jaider
                Oct 1 '17 at 12:59















                159















                1. Click 'Show All Files' in Solution Explorer

                2. Right click over 'wwwroot' select 'Exclude From Project'

                3. Right click over 'wwwroot' select 'Include in Project'






                share|improve this answer

















                • 2




                  Doing this solved the problem for me, but what actually happened to make it work?
                  – Rono
                  Aug 30 '17 at 14:49










                • @Rono Looks like it explicitly identifies all the files in your wwwroot file in the .csproj file. eg: i.imgur.com/4SPnQ5h.png
                  – J. Schei
                  Sep 1 '17 at 20:18








                • 4




                  Worked for me as well - and a far more safe way to go in my opinion than the accepted answer.
                  – brinch
                  Sep 12 '17 at 6:09












                • It worked for me too! Disabling DefaultContentItems helped build my solution, but images, CSSs and other files were not showing.
                  – BrunoSerrano
                  Sep 14 '17 at 17:01










                • Works! You might have to close and re-open the Solution Explorer in order to make the wwwroot folder visible again after step 2.
                  – Lorentz
                  Sep 21 '17 at 13:45
















                159















                1. Click 'Show All Files' in Solution Explorer

                2. Right click over 'wwwroot' select 'Exclude From Project'

                3. Right click over 'wwwroot' select 'Include in Project'






                share|improve this answer

















                • 2




                  Doing this solved the problem for me, but what actually happened to make it work?
                  – Rono
                  Aug 30 '17 at 14:49










                • @Rono Looks like it explicitly identifies all the files in your wwwroot file in the .csproj file. eg: i.imgur.com/4SPnQ5h.png
                  – J. Schei
                  Sep 1 '17 at 20:18








                • 4




                  Worked for me as well - and a far more safe way to go in my opinion than the accepted answer.
                  – brinch
                  Sep 12 '17 at 6:09












                • It worked for me too! Disabling DefaultContentItems helped build my solution, but images, CSSs and other files were not showing.
                  – BrunoSerrano
                  Sep 14 '17 at 17:01










                • Works! You might have to close and re-open the Solution Explorer in order to make the wwwroot folder visible again after step 2.
                  – Lorentz
                  Sep 21 '17 at 13:45














                159












                159








                159







                1. Click 'Show All Files' in Solution Explorer

                2. Right click over 'wwwroot' select 'Exclude From Project'

                3. Right click over 'wwwroot' select 'Include in Project'






                share|improve this answer













                1. Click 'Show All Files' in Solution Explorer

                2. Right click over 'wwwroot' select 'Exclude From Project'

                3. Right click over 'wwwroot' select 'Include in Project'







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 17 '17 at 7:46









                Dzhefer

                1,6121106




                1,6121106








                • 2




                  Doing this solved the problem for me, but what actually happened to make it work?
                  – Rono
                  Aug 30 '17 at 14:49










                • @Rono Looks like it explicitly identifies all the files in your wwwroot file in the .csproj file. eg: i.imgur.com/4SPnQ5h.png
                  – J. Schei
                  Sep 1 '17 at 20:18








                • 4




                  Worked for me as well - and a far more safe way to go in my opinion than the accepted answer.
                  – brinch
                  Sep 12 '17 at 6:09












                • It worked for me too! Disabling DefaultContentItems helped build my solution, but images, CSSs and other files were not showing.
                  – BrunoSerrano
                  Sep 14 '17 at 17:01










                • Works! You might have to close and re-open the Solution Explorer in order to make the wwwroot folder visible again after step 2.
                  – Lorentz
                  Sep 21 '17 at 13:45














                • 2




                  Doing this solved the problem for me, but what actually happened to make it work?
                  – Rono
                  Aug 30 '17 at 14:49










                • @Rono Looks like it explicitly identifies all the files in your wwwroot file in the .csproj file. eg: i.imgur.com/4SPnQ5h.png
                  – J. Schei
                  Sep 1 '17 at 20:18








                • 4




                  Worked for me as well - and a far more safe way to go in my opinion than the accepted answer.
                  – brinch
                  Sep 12 '17 at 6:09












                • It worked for me too! Disabling DefaultContentItems helped build my solution, but images, CSSs and other files were not showing.
                  – BrunoSerrano
                  Sep 14 '17 at 17:01










                • Works! You might have to close and re-open the Solution Explorer in order to make the wwwroot folder visible again after step 2.
                  – Lorentz
                  Sep 21 '17 at 13:45








                2




                2




                Doing this solved the problem for me, but what actually happened to make it work?
                – Rono
                Aug 30 '17 at 14:49




                Doing this solved the problem for me, but what actually happened to make it work?
                – Rono
                Aug 30 '17 at 14:49












                @Rono Looks like it explicitly identifies all the files in your wwwroot file in the .csproj file. eg: i.imgur.com/4SPnQ5h.png
                – J. Schei
                Sep 1 '17 at 20:18






                @Rono Looks like it explicitly identifies all the files in your wwwroot file in the .csproj file. eg: i.imgur.com/4SPnQ5h.png
                – J. Schei
                Sep 1 '17 at 20:18






                4




                4




                Worked for me as well - and a far more safe way to go in my opinion than the accepted answer.
                – brinch
                Sep 12 '17 at 6:09






                Worked for me as well - and a far more safe way to go in my opinion than the accepted answer.
                – brinch
                Sep 12 '17 at 6:09














                It worked for me too! Disabling DefaultContentItems helped build my solution, but images, CSSs and other files were not showing.
                – BrunoSerrano
                Sep 14 '17 at 17:01




                It worked for me too! Disabling DefaultContentItems helped build my solution, but images, CSSs and other files were not showing.
                – BrunoSerrano
                Sep 14 '17 at 17:01












                Works! You might have to close and re-open the Solution Explorer in order to make the wwwroot folder visible again after step 2.
                – Lorentz
                Sep 21 '17 at 13:45




                Works! You might have to close and re-open the Solution Explorer in order to make the wwwroot folder visible again after step 2.
                – Lorentz
                Sep 21 '17 at 13:45











                21














                This worked in my case:



                 <PropertyGroup>
                ...
                <EnableDefaultContentItems>false</EnableDefaultContentItems>
                </PropertyGroup>





                share|improve this answer

















                • 2




                  As stated in my comment to Pinki's answer, I would not propose this as solution as this could lead to more errors.
                  – Matt
                  Aug 15 '17 at 14:53










                • I actually ran into bigger problems setting this option to false. I would also recommend not setting it to false.
                  – Rwiti
                  Dec 7 '17 at 18:47


















                21














                This worked in my case:



                 <PropertyGroup>
                ...
                <EnableDefaultContentItems>false</EnableDefaultContentItems>
                </PropertyGroup>





                share|improve this answer

















                • 2




                  As stated in my comment to Pinki's answer, I would not propose this as solution as this could lead to more errors.
                  – Matt
                  Aug 15 '17 at 14:53










                • I actually ran into bigger problems setting this option to false. I would also recommend not setting it to false.
                  – Rwiti
                  Dec 7 '17 at 18:47
















                21












                21








                21






                This worked in my case:



                 <PropertyGroup>
                ...
                <EnableDefaultContentItems>false</EnableDefaultContentItems>
                </PropertyGroup>





                share|improve this answer












                This worked in my case:



                 <PropertyGroup>
                ...
                <EnableDefaultContentItems>false</EnableDefaultContentItems>
                </PropertyGroup>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 5 '17 at 3:44









                harveyt

                1,3491412




                1,3491412








                • 2




                  As stated in my comment to Pinki's answer, I would not propose this as solution as this could lead to more errors.
                  – Matt
                  Aug 15 '17 at 14:53










                • I actually ran into bigger problems setting this option to false. I would also recommend not setting it to false.
                  – Rwiti
                  Dec 7 '17 at 18:47
















                • 2




                  As stated in my comment to Pinki's answer, I would not propose this as solution as this could lead to more errors.
                  – Matt
                  Aug 15 '17 at 14:53










                • I actually ran into bigger problems setting this option to false. I would also recommend not setting it to false.
                  – Rwiti
                  Dec 7 '17 at 18:47










                2




                2




                As stated in my comment to Pinki's answer, I would not propose this as solution as this could lead to more errors.
                – Matt
                Aug 15 '17 at 14:53




                As stated in my comment to Pinki's answer, I would not propose this as solution as this could lead to more errors.
                – Matt
                Aug 15 '17 at 14:53












                I actually ran into bigger problems setting this option to false. I would also recommend not setting it to false.
                – Rwiti
                Dec 7 '17 at 18:47






                I actually ran into bigger problems setting this option to false. I would also recommend not setting it to false.
                – Rwiti
                Dec 7 '17 at 18:47













                12














                It happend when I upgrade my project from .NET Core 1.X to 2.0 just now. Here is my solution.




                • Open xxx.csproj, or right click project

                • Unload Project

                • Edit xxx.csproj.


                Then remove ItemGroup items start with <Content Include = "wwwrootxxxxx"






                share|improve this answer























                • Thanks! Note: It seems to be related to latest Visual Studio version 15.3, not directly to .NET Core 2.0
                  – Vincent V.
                  Aug 21 '17 at 8:29
















                12














                It happend when I upgrade my project from .NET Core 1.X to 2.0 just now. Here is my solution.




                • Open xxx.csproj, or right click project

                • Unload Project

                • Edit xxx.csproj.


                Then remove ItemGroup items start with <Content Include = "wwwrootxxxxx"






                share|improve this answer























                • Thanks! Note: It seems to be related to latest Visual Studio version 15.3, not directly to .NET Core 2.0
                  – Vincent V.
                  Aug 21 '17 at 8:29














                12












                12








                12






                It happend when I upgrade my project from .NET Core 1.X to 2.0 just now. Here is my solution.




                • Open xxx.csproj, or right click project

                • Unload Project

                • Edit xxx.csproj.


                Then remove ItemGroup items start with <Content Include = "wwwrootxxxxx"






                share|improve this answer














                It happend when I upgrade my project from .NET Core 1.X to 2.0 just now. Here is my solution.




                • Open xxx.csproj, or right click project

                • Unload Project

                • Edit xxx.csproj.


                Then remove ItemGroup items start with <Content Include = "wwwrootxxxxx"







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 11 '17 at 21:38









                usefulBee

                4,91153559




                4,91153559










                answered Aug 15 '17 at 10:01









                wtf512

                94821631




                94821631












                • Thanks! Note: It seems to be related to latest Visual Studio version 15.3, not directly to .NET Core 2.0
                  – Vincent V.
                  Aug 21 '17 at 8:29


















                • Thanks! Note: It seems to be related to latest Visual Studio version 15.3, not directly to .NET Core 2.0
                  – Vincent V.
                  Aug 21 '17 at 8:29
















                Thanks! Note: It seems to be related to latest Visual Studio version 15.3, not directly to .NET Core 2.0
                – Vincent V.
                Aug 21 '17 at 8:29




                Thanks! Note: It seems to be related to latest Visual Studio version 15.3, not directly to .NET Core 2.0
                – Vincent V.
                Aug 21 '17 at 8:29











                10














                My issues was close but not the exact same. My error was this:




                C:Program Filesdotnetsdk2.0.0-preview2-006497SdksMicrosoft.NET.SdkbuildMicrosoft.NET.Sdk.DefaultItems.targets(285,5): 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. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js' [C:Avantia ProjectsTime Cardavantia-timesheetSolutionAlmanacAlmanac.csproj]




                If I did this:



                <EnableDefaultContentItems>false</EnableDefaultContentItems>


                It would not compile as all of the sudden Areas would not be recognized.



                My solution, seems odd, but the message is telling me so, there were duplicate files:




                The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js'




                Looking at my .csproj file:



                <ItemGroup>
                <Content Include="pdf.js" />
                <Content Include="wwwrootjspackage.json" />
                <Content Include="wwwrootjspdf.js" />
                <Content Include="wwwrootjsKOBindings.js" />
                <Content Include="wwwrootjsKOPleaseWait.js" />
                <Content Include="wwwrootjsProjectTimeAdd.js" />
                <Content Include="wwwrootjsTimeAdminInvoice.js" />
                <Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
                </ItemGroup>


                This was the ONLY location within the entire project where these files were references (aside from where they were loaded.) So the phrase duplicate does not make any sense to me. However, commenting those files out as such, took care of my problem:



                <ItemGroup>
                <Content Include="pdf.js" />
                <Content Include="wwwrootjspackage.json" />
                <Content Include="wwwrootjspdf.js" />
                <!--
                <Content Include="wwwrootjsKOBindings.js" />
                <Content Include="wwwrootjsKOPleaseWait.js" />
                <Content Include="wwwrootjsProjectTimeAdd.js" />
                <Content Include="wwwrootjsTimeAdminInvoice.js" />
                <Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
                -->
                </ItemGroup>


                I assume this has something to do with the 2.0.0-preview2-006497 that I recently installed.



                Also, this link mentions talks about globs. But does not tell me where that is. It talks about SDKs and such. Yet the answer was my custom .js files. That link needs to be updated or expanded on IMHO. Hope this helps someone.






                share|improve this answer





















                • Would love to know why this works. However, just worked for me. =)
                  – Frog Pr1nce
                  Aug 31 '17 at 18:10
















                10














                My issues was close but not the exact same. My error was this:




                C:Program Filesdotnetsdk2.0.0-preview2-006497SdksMicrosoft.NET.SdkbuildMicrosoft.NET.Sdk.DefaultItems.targets(285,5): 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. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js' [C:Avantia ProjectsTime Cardavantia-timesheetSolutionAlmanacAlmanac.csproj]




                If I did this:



                <EnableDefaultContentItems>false</EnableDefaultContentItems>


                It would not compile as all of the sudden Areas would not be recognized.



                My solution, seems odd, but the message is telling me so, there were duplicate files:




                The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js'




                Looking at my .csproj file:



                <ItemGroup>
                <Content Include="pdf.js" />
                <Content Include="wwwrootjspackage.json" />
                <Content Include="wwwrootjspdf.js" />
                <Content Include="wwwrootjsKOBindings.js" />
                <Content Include="wwwrootjsKOPleaseWait.js" />
                <Content Include="wwwrootjsProjectTimeAdd.js" />
                <Content Include="wwwrootjsTimeAdminInvoice.js" />
                <Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
                </ItemGroup>


                This was the ONLY location within the entire project where these files were references (aside from where they were loaded.) So the phrase duplicate does not make any sense to me. However, commenting those files out as such, took care of my problem:



                <ItemGroup>
                <Content Include="pdf.js" />
                <Content Include="wwwrootjspackage.json" />
                <Content Include="wwwrootjspdf.js" />
                <!--
                <Content Include="wwwrootjsKOBindings.js" />
                <Content Include="wwwrootjsKOPleaseWait.js" />
                <Content Include="wwwrootjsProjectTimeAdd.js" />
                <Content Include="wwwrootjsTimeAdminInvoice.js" />
                <Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
                -->
                </ItemGroup>


                I assume this has something to do with the 2.0.0-preview2-006497 that I recently installed.



                Also, this link mentions talks about globs. But does not tell me where that is. It talks about SDKs and such. Yet the answer was my custom .js files. That link needs to be updated or expanded on IMHO. Hope this helps someone.






                share|improve this answer





















                • Would love to know why this works. However, just worked for me. =)
                  – Frog Pr1nce
                  Aug 31 '17 at 18:10














                10












                10








                10






                My issues was close but not the exact same. My error was this:




                C:Program Filesdotnetsdk2.0.0-preview2-006497SdksMicrosoft.NET.SdkbuildMicrosoft.NET.Sdk.DefaultItems.targets(285,5): 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. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js' [C:Avantia ProjectsTime Cardavantia-timesheetSolutionAlmanacAlmanac.csproj]




                If I did this:



                <EnableDefaultContentItems>false</EnableDefaultContentItems>


                It would not compile as all of the sudden Areas would not be recognized.



                My solution, seems odd, but the message is telling me so, there were duplicate files:




                The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js'




                Looking at my .csproj file:



                <ItemGroup>
                <Content Include="pdf.js" />
                <Content Include="wwwrootjspackage.json" />
                <Content Include="wwwrootjspdf.js" />
                <Content Include="wwwrootjsKOBindings.js" />
                <Content Include="wwwrootjsKOPleaseWait.js" />
                <Content Include="wwwrootjsProjectTimeAdd.js" />
                <Content Include="wwwrootjsTimeAdminInvoice.js" />
                <Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
                </ItemGroup>


                This was the ONLY location within the entire project where these files were references (aside from where they were loaded.) So the phrase duplicate does not make any sense to me. However, commenting those files out as such, took care of my problem:



                <ItemGroup>
                <Content Include="pdf.js" />
                <Content Include="wwwrootjspackage.json" />
                <Content Include="wwwrootjspdf.js" />
                <!--
                <Content Include="wwwrootjsKOBindings.js" />
                <Content Include="wwwrootjsKOPleaseWait.js" />
                <Content Include="wwwrootjsProjectTimeAdd.js" />
                <Content Include="wwwrootjsTimeAdminInvoice.js" />
                <Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
                -->
                </ItemGroup>


                I assume this has something to do with the 2.0.0-preview2-006497 that I recently installed.



                Also, this link mentions talks about globs. But does not tell me where that is. It talks about SDKs and such. Yet the answer was my custom .js files. That link needs to be updated or expanded on IMHO. Hope this helps someone.






                share|improve this answer












                My issues was close but not the exact same. My error was this:




                C:Program Filesdotnetsdk2.0.0-preview2-006497SdksMicrosoft.NET.SdkbuildMicrosoft.NET.Sdk.DefaultItems.targets(285,5): 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. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js' [C:Avantia ProjectsTime Cardavantia-timesheetSolutionAlmanacAlmanac.csproj]




                If I did this:



                <EnableDefaultContentItems>false</EnableDefaultContentItems>


                It would not compile as all of the sudden Areas would not be recognized.



                My solution, seems odd, but the message is telling me so, there were duplicate files:




                The duplicate items were: 'wwwrootjsKOBindings.js'; 'wwwrootjsKOPleaseWait.js'; 'wwwrootjsProjectTimeAdd.js'; 'wwwrootjsTimeAdminInvoice.js'; 'wwwrootjsTimeAdminPayPeriodTotals.js'




                Looking at my .csproj file:



                <ItemGroup>
                <Content Include="pdf.js" />
                <Content Include="wwwrootjspackage.json" />
                <Content Include="wwwrootjspdf.js" />
                <Content Include="wwwrootjsKOBindings.js" />
                <Content Include="wwwrootjsKOPleaseWait.js" />
                <Content Include="wwwrootjsProjectTimeAdd.js" />
                <Content Include="wwwrootjsTimeAdminInvoice.js" />
                <Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
                </ItemGroup>


                This was the ONLY location within the entire project where these files were references (aside from where they were loaded.) So the phrase duplicate does not make any sense to me. However, commenting those files out as such, took care of my problem:



                <ItemGroup>
                <Content Include="pdf.js" />
                <Content Include="wwwrootjspackage.json" />
                <Content Include="wwwrootjspdf.js" />
                <!--
                <Content Include="wwwrootjsKOBindings.js" />
                <Content Include="wwwrootjsKOPleaseWait.js" />
                <Content Include="wwwrootjsProjectTimeAdd.js" />
                <Content Include="wwwrootjsTimeAdminInvoice.js" />
                <Content Include="wwwrootjsTimeAdminPayPeriodTotals.js" />
                -->
                </ItemGroup>


                I assume this has something to do with the 2.0.0-preview2-006497 that I recently installed.



                Also, this link mentions talks about globs. But does not tell me where that is. It talks about SDKs and such. Yet the answer was my custom .js files. That link needs to be updated or expanded on IMHO. Hope this helps someone.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 30 '17 at 18:20









                Grandizer

                1,26112750




                1,26112750












                • Would love to know why this works. However, just worked for me. =)
                  – Frog Pr1nce
                  Aug 31 '17 at 18:10


















                • Would love to know why this works. However, just worked for me. =)
                  – Frog Pr1nce
                  Aug 31 '17 at 18:10
















                Would love to know why this works. However, just worked for me. =)
                – Frog Pr1nce
                Aug 31 '17 at 18:10




                Would love to know why this works. However, just worked for me. =)
                – Frog Pr1nce
                Aug 31 '17 at 18:10











                6














                As link says, you can disable this behavior (auto-include) and include all content explicitly by adding this into your csproj file:



                <PropertyGroup>
                <EnableDefaultContentItems>false</EnableDefaultContentItems>
                </PropertyGroup>





                share|improve this answer



















                • 1




                  When I add that to my csproj file and I remove the css/js itemgroup, I get the following error: CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/mnt/c/Dev/myproject/MyProject/MyProject.csproj] The build failed. Please fix the build errors and run again.
                  – jao
                  Apr 10 '17 at 16:49






                • 2




                  "Content" not "Compile" - Doesn't it?
                  – harveyt
                  Jun 5 '17 at 3:47










                • Of course "Content". My bad. Fixed. Thank you.
                  – Dmitry
                  Aug 17 '17 at 8:03










                • One side note....if you don't explicitly include your Views folder, it won't publish your views with this setting
                  – saluce
                  Aug 21 '17 at 19:02










                • I tried this but it didn't work. still getting the same error
                  – pantonis
                  Aug 31 '17 at 6:34


















                6














                As link says, you can disable this behavior (auto-include) and include all content explicitly by adding this into your csproj file:



                <PropertyGroup>
                <EnableDefaultContentItems>false</EnableDefaultContentItems>
                </PropertyGroup>





                share|improve this answer



















                • 1




                  When I add that to my csproj file and I remove the css/js itemgroup, I get the following error: CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/mnt/c/Dev/myproject/MyProject/MyProject.csproj] The build failed. Please fix the build errors and run again.
                  – jao
                  Apr 10 '17 at 16:49






                • 2




                  "Content" not "Compile" - Doesn't it?
                  – harveyt
                  Jun 5 '17 at 3:47










                • Of course "Content". My bad. Fixed. Thank you.
                  – Dmitry
                  Aug 17 '17 at 8:03










                • One side note....if you don't explicitly include your Views folder, it won't publish your views with this setting
                  – saluce
                  Aug 21 '17 at 19:02










                • I tried this but it didn't work. still getting the same error
                  – pantonis
                  Aug 31 '17 at 6:34
















                6












                6








                6






                As link says, you can disable this behavior (auto-include) and include all content explicitly by adding this into your csproj file:



                <PropertyGroup>
                <EnableDefaultContentItems>false</EnableDefaultContentItems>
                </PropertyGroup>





                share|improve this answer














                As link says, you can disable this behavior (auto-include) and include all content explicitly by adding this into your csproj file:



                <PropertyGroup>
                <EnableDefaultContentItems>false</EnableDefaultContentItems>
                </PropertyGroup>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Aug 17 '17 at 8:02

























                answered Apr 10 '17 at 15:18









                Dmitry

                7,73112845




                7,73112845








                • 1




                  When I add that to my csproj file and I remove the css/js itemgroup, I get the following error: CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/mnt/c/Dev/myproject/MyProject/MyProject.csproj] The build failed. Please fix the build errors and run again.
                  – jao
                  Apr 10 '17 at 16:49






                • 2




                  "Content" not "Compile" - Doesn't it?
                  – harveyt
                  Jun 5 '17 at 3:47










                • Of course "Content". My bad. Fixed. Thank you.
                  – Dmitry
                  Aug 17 '17 at 8:03










                • One side note....if you don't explicitly include your Views folder, it won't publish your views with this setting
                  – saluce
                  Aug 21 '17 at 19:02










                • I tried this but it didn't work. still getting the same error
                  – pantonis
                  Aug 31 '17 at 6:34
















                • 1




                  When I add that to my csproj file and I remove the css/js itemgroup, I get the following error: CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/mnt/c/Dev/myproject/MyProject/MyProject.csproj] The build failed. Please fix the build errors and run again.
                  – jao
                  Apr 10 '17 at 16:49






                • 2




                  "Content" not "Compile" - Doesn't it?
                  – harveyt
                  Jun 5 '17 at 3:47










                • Of course "Content". My bad. Fixed. Thank you.
                  – Dmitry
                  Aug 17 '17 at 8:03










                • One side note....if you don't explicitly include your Views folder, it won't publish your views with this setting
                  – saluce
                  Aug 21 '17 at 19:02










                • I tried this but it didn't work. still getting the same error
                  – pantonis
                  Aug 31 '17 at 6:34










                1




                1




                When I add that to my csproj file and I remove the css/js itemgroup, I get the following error: CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/mnt/c/Dev/myproject/MyProject/MyProject.csproj] The build failed. Please fix the build errors and run again.
                – jao
                Apr 10 '17 at 16:49




                When I add that to my csproj file and I remove the css/js itemgroup, I get the following error: CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/mnt/c/Dev/myproject/MyProject/MyProject.csproj] The build failed. Please fix the build errors and run again.
                – jao
                Apr 10 '17 at 16:49




                2




                2




                "Content" not "Compile" - Doesn't it?
                – harveyt
                Jun 5 '17 at 3:47




                "Content" not "Compile" - Doesn't it?
                – harveyt
                Jun 5 '17 at 3:47












                Of course "Content". My bad. Fixed. Thank you.
                – Dmitry
                Aug 17 '17 at 8:03




                Of course "Content". My bad. Fixed. Thank you.
                – Dmitry
                Aug 17 '17 at 8:03












                One side note....if you don't explicitly include your Views folder, it won't publish your views with this setting
                – saluce
                Aug 21 '17 at 19:02




                One side note....if you don't explicitly include your Views folder, it won't publish your views with this setting
                – saluce
                Aug 21 '17 at 19:02












                I tried this but it didn't work. still getting the same error
                – pantonis
                Aug 31 '17 at 6:34






                I tried this but it didn't work. still getting the same error
                – pantonis
                Aug 31 '17 at 6:34













                2














                In my case, I solved this by deleting all files from the wwwroot-Directory in VS.
                Unload and reload the Project.
                Copy all files back in with VS.
                Done






                share|improve this answer





















                • None of the top solutions worked for me I did this before reading your comment and this works flawless!!! I excluded the wwwroot, controllers, views folders and added them back and now everything works fine!
                  – revobtz
                  Aug 16 '17 at 19:09
















                2














                In my case, I solved this by deleting all files from the wwwroot-Directory in VS.
                Unload and reload the Project.
                Copy all files back in with VS.
                Done






                share|improve this answer





















                • None of the top solutions worked for me I did this before reading your comment and this works flawless!!! I excluded the wwwroot, controllers, views folders and added them back and now everything works fine!
                  – revobtz
                  Aug 16 '17 at 19:09














                2












                2








                2






                In my case, I solved this by deleting all files from the wwwroot-Directory in VS.
                Unload and reload the Project.
                Copy all files back in with VS.
                Done






                share|improve this answer












                In my case, I solved this by deleting all files from the wwwroot-Directory in VS.
                Unload and reload the Project.
                Copy all files back in with VS.
                Done







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 15 '17 at 11:47









                Alex Freund

                214




                214












                • None of the top solutions worked for me I did this before reading your comment and this works flawless!!! I excluded the wwwroot, controllers, views folders and added them back and now everything works fine!
                  – revobtz
                  Aug 16 '17 at 19:09


















                • None of the top solutions worked for me I did this before reading your comment and this works flawless!!! I excluded the wwwroot, controllers, views folders and added them back and now everything works fine!
                  – revobtz
                  Aug 16 '17 at 19:09
















                None of the top solutions worked for me I did this before reading your comment and this works flawless!!! I excluded the wwwroot, controllers, views folders and added them back and now everything works fine!
                – revobtz
                Aug 16 '17 at 19:09




                None of the top solutions worked for me I did this before reading your comment and this works flawless!!! I excluded the wwwroot, controllers, views folders and added them back and now everything works fine!
                – revobtz
                Aug 16 '17 at 19:09











                2














                Actually, Asp.net core automatically include content from wwwrootcss , wwwrootjs and wwwrootlib location, so despite this if your csproj file explicitly include content from those directories then those content will be duplicated so removing content from you csproj file is the better way to get rid of this error. So remove below content-



                  <ItemGroup>
                <Compile Remove="wwwrootlibjquery-validation**" />
                <Content Remove="wwwrootlibjquery-validation**" />
                <EmbeddedResource Remove="wwwrootlibjquery-validation**" />
                <None Remove="wwwrootlibjquery-validation**" />
                </ItemGroup>

                <ItemGroup>
                <Content Include="wwwrootcssBasicQuotation.css" />
                <Content Include="wwwrootjsBasicQuotation.js" />
                </ItemGroup>





                share|improve this answer

















                • 1




                  This happened to me on updating Visual Studio to 15.3. To prevent breaking changes to my colleagues who have not updated yet, I had to add <PropertyGroup> <EnableDefaultContentItems>false</EnableDefaultContentItems> </PropertyGroup> to the .csproj file.
                  – saluce
                  Aug 17 '17 at 18:41










                • @saluce yes you are right, the same solution you can use in your context too. the choice is based on the developer whether he wants to keep EnableDefaultContentItems or not. They are two different approach
                  – Mostafiz
                  Aug 18 '17 at 8:48










                • My point was that the only change I made was upgrading Visual Studio to 15.3. I made no changes to my project, but prior to the upgrade, this setting was not required.
                  – saluce
                  Aug 19 '17 at 21:25
















                2














                Actually, Asp.net core automatically include content from wwwrootcss , wwwrootjs and wwwrootlib location, so despite this if your csproj file explicitly include content from those directories then those content will be duplicated so removing content from you csproj file is the better way to get rid of this error. So remove below content-



                  <ItemGroup>
                <Compile Remove="wwwrootlibjquery-validation**" />
                <Content Remove="wwwrootlibjquery-validation**" />
                <EmbeddedResource Remove="wwwrootlibjquery-validation**" />
                <None Remove="wwwrootlibjquery-validation**" />
                </ItemGroup>

                <ItemGroup>
                <Content Include="wwwrootcssBasicQuotation.css" />
                <Content Include="wwwrootjsBasicQuotation.js" />
                </ItemGroup>





                share|improve this answer

















                • 1




                  This happened to me on updating Visual Studio to 15.3. To prevent breaking changes to my colleagues who have not updated yet, I had to add <PropertyGroup> <EnableDefaultContentItems>false</EnableDefaultContentItems> </PropertyGroup> to the .csproj file.
                  – saluce
                  Aug 17 '17 at 18:41










                • @saluce yes you are right, the same solution you can use in your context too. the choice is based on the developer whether he wants to keep EnableDefaultContentItems or not. They are two different approach
                  – Mostafiz
                  Aug 18 '17 at 8:48










                • My point was that the only change I made was upgrading Visual Studio to 15.3. I made no changes to my project, but prior to the upgrade, this setting was not required.
                  – saluce
                  Aug 19 '17 at 21:25














                2












                2








                2






                Actually, Asp.net core automatically include content from wwwrootcss , wwwrootjs and wwwrootlib location, so despite this if your csproj file explicitly include content from those directories then those content will be duplicated so removing content from you csproj file is the better way to get rid of this error. So remove below content-



                  <ItemGroup>
                <Compile Remove="wwwrootlibjquery-validation**" />
                <Content Remove="wwwrootlibjquery-validation**" />
                <EmbeddedResource Remove="wwwrootlibjquery-validation**" />
                <None Remove="wwwrootlibjquery-validation**" />
                </ItemGroup>

                <ItemGroup>
                <Content Include="wwwrootcssBasicQuotation.css" />
                <Content Include="wwwrootjsBasicQuotation.js" />
                </ItemGroup>





                share|improve this answer












                Actually, Asp.net core automatically include content from wwwrootcss , wwwrootjs and wwwrootlib location, so despite this if your csproj file explicitly include content from those directories then those content will be duplicated so removing content from you csproj file is the better way to get rid of this error. So remove below content-



                  <ItemGroup>
                <Compile Remove="wwwrootlibjquery-validation**" />
                <Content Remove="wwwrootlibjquery-validation**" />
                <EmbeddedResource Remove="wwwrootlibjquery-validation**" />
                <None Remove="wwwrootlibjquery-validation**" />
                </ItemGroup>

                <ItemGroup>
                <Content Include="wwwrootcssBasicQuotation.css" />
                <Content Include="wwwrootjsBasicQuotation.js" />
                </ItemGroup>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 15 '17 at 12:34









                Mostafiz

                6,15831633




                6,15831633








                • 1




                  This happened to me on updating Visual Studio to 15.3. To prevent breaking changes to my colleagues who have not updated yet, I had to add <PropertyGroup> <EnableDefaultContentItems>false</EnableDefaultContentItems> </PropertyGroup> to the .csproj file.
                  – saluce
                  Aug 17 '17 at 18:41










                • @saluce yes you are right, the same solution you can use in your context too. the choice is based on the developer whether he wants to keep EnableDefaultContentItems or not. They are two different approach
                  – Mostafiz
                  Aug 18 '17 at 8:48










                • My point was that the only change I made was upgrading Visual Studio to 15.3. I made no changes to my project, but prior to the upgrade, this setting was not required.
                  – saluce
                  Aug 19 '17 at 21:25














                • 1




                  This happened to me on updating Visual Studio to 15.3. To prevent breaking changes to my colleagues who have not updated yet, I had to add <PropertyGroup> <EnableDefaultContentItems>false</EnableDefaultContentItems> </PropertyGroup> to the .csproj file.
                  – saluce
                  Aug 17 '17 at 18:41










                • @saluce yes you are right, the same solution you can use in your context too. the choice is based on the developer whether he wants to keep EnableDefaultContentItems or not. They are two different approach
                  – Mostafiz
                  Aug 18 '17 at 8:48










                • My point was that the only change I made was upgrading Visual Studio to 15.3. I made no changes to my project, but prior to the upgrade, this setting was not required.
                  – saluce
                  Aug 19 '17 at 21:25








                1




                1




                This happened to me on updating Visual Studio to 15.3. To prevent breaking changes to my colleagues who have not updated yet, I had to add <PropertyGroup> <EnableDefaultContentItems>false</EnableDefaultContentItems> </PropertyGroup> to the .csproj file.
                – saluce
                Aug 17 '17 at 18:41




                This happened to me on updating Visual Studio to 15.3. To prevent breaking changes to my colleagues who have not updated yet, I had to add <PropertyGroup> <EnableDefaultContentItems>false</EnableDefaultContentItems> </PropertyGroup> to the .csproj file.
                – saluce
                Aug 17 '17 at 18:41












                @saluce yes you are right, the same solution you can use in your context too. the choice is based on the developer whether he wants to keep EnableDefaultContentItems or not. They are two different approach
                – Mostafiz
                Aug 18 '17 at 8:48




                @saluce yes you are right, the same solution you can use in your context too. the choice is based on the developer whether he wants to keep EnableDefaultContentItems or not. They are two different approach
                – Mostafiz
                Aug 18 '17 at 8:48












                My point was that the only change I made was upgrading Visual Studio to 15.3. I made no changes to my project, but prior to the upgrade, this setting was not required.
                – saluce
                Aug 19 '17 at 21:25




                My point was that the only change I made was upgrading Visual Studio to 15.3. I made no changes to my project, but prior to the upgrade, this setting was not required.
                – saluce
                Aug 19 '17 at 21:25











                1














                Not that I can see it in your example above, to help other SO searchers..



                You can also get this error when you have the same file listed twice in <Content Include="xxx" /> elements in your csproj file.



                Remove the duplicate and rebuild.






                share|improve this answer


























                  1














                  Not that I can see it in your example above, to help other SO searchers..



                  You can also get this error when you have the same file listed twice in <Content Include="xxx" /> elements in your csproj file.



                  Remove the duplicate and rebuild.






                  share|improve this answer
























                    1












                    1








                    1






                    Not that I can see it in your example above, to help other SO searchers..



                    You can also get this error when you have the same file listed twice in <Content Include="xxx" /> elements in your csproj file.



                    Remove the duplicate and rebuild.






                    share|improve this answer












                    Not that I can see it in your example above, to help other SO searchers..



                    You can also get this error when you have the same file listed twice in <Content Include="xxx" /> elements in your csproj file.



                    Remove the duplicate and rebuild.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 11 '17 at 7:50









                    Sam

                    295112




                    295112























                        1














                        Under Visual Studio 2017 15.3, with .NET Core 2.0,
                        EnableDefaultCompileItems did not work for me.



                        I needed to add this to my .csproj



                          <PropertyGroup>
                        <EnableDefaultContentItems>false</EnableDefaultContentItems>
                        </PropertyGroup>





                        share|improve this answer























                        • For me (visual studio 15.3.4 .NET framework 4.5.2) EnableDefaultContentItems did not work while EnableDefaultCompileItems did.
                          – hlovdal
                          Sep 13 '17 at 12:00
















                        1














                        Under Visual Studio 2017 15.3, with .NET Core 2.0,
                        EnableDefaultCompileItems did not work for me.



                        I needed to add this to my .csproj



                          <PropertyGroup>
                        <EnableDefaultContentItems>false</EnableDefaultContentItems>
                        </PropertyGroup>





                        share|improve this answer























                        • For me (visual studio 15.3.4 .NET framework 4.5.2) EnableDefaultContentItems did not work while EnableDefaultCompileItems did.
                          – hlovdal
                          Sep 13 '17 at 12:00














                        1












                        1








                        1






                        Under Visual Studio 2017 15.3, with .NET Core 2.0,
                        EnableDefaultCompileItems did not work for me.



                        I needed to add this to my .csproj



                          <PropertyGroup>
                        <EnableDefaultContentItems>false</EnableDefaultContentItems>
                        </PropertyGroup>





                        share|improve this answer














                        Under Visual Studio 2017 15.3, with .NET Core 2.0,
                        EnableDefaultCompileItems did not work for me.



                        I needed to add this to my .csproj



                          <PropertyGroup>
                        <EnableDefaultContentItems>false</EnableDefaultContentItems>
                        </PropertyGroup>






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Aug 14 '17 at 21:47

























                        answered Aug 9 '17 at 9:04









                        Kyriacos

                        73125




                        73125












                        • For me (visual studio 15.3.4 .NET framework 4.5.2) EnableDefaultContentItems did not work while EnableDefaultCompileItems did.
                          – hlovdal
                          Sep 13 '17 at 12:00


















                        • For me (visual studio 15.3.4 .NET framework 4.5.2) EnableDefaultContentItems did not work while EnableDefaultCompileItems did.
                          – hlovdal
                          Sep 13 '17 at 12:00
















                        For me (visual studio 15.3.4 .NET framework 4.5.2) EnableDefaultContentItems did not work while EnableDefaultCompileItems did.
                        – hlovdal
                        Sep 13 '17 at 12:00




                        For me (visual studio 15.3.4 .NET framework 4.5.2) EnableDefaultContentItems did not work while EnableDefaultCompileItems did.
                        – hlovdal
                        Sep 13 '17 at 12:00











                        1














                        I found a different proper solution.




                        1. Right click on your mvc project and click Edit csproj.

                        2. If you are adding files under wwwroot, just move them to a folder under wwwroot, let's say it "theme"


                        And delete all content tags in csproj file if their exists, an example;



                        <Content Include="wwwrootthemefavicon.ico" />
                        <Content Include="wwwrootthemefontscyrillic-ext400.woff2" />
                        <Content Include="wwwrootthemefontscyrillic-ext700.woff2" />


                        And only add this;



                          <ItemGroup>
                        <Folder Include="wwwroottheme" />
                        </ItemGroup>


                        So, csproj file should be look like this;



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

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

                        <PropertyGroup>
                        <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
                        </PropertyGroup>

                        <ItemGroup>
                        <Folder Include="wwwroottheme" />
                        </ItemGroup>
                        <ItemGroup>
                        <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
                        ...


                        With that way, I think you are adding all files under theme folder. So not include them one by one which occours some erros.






                        share|improve this answer


























                          1














                          I found a different proper solution.




                          1. Right click on your mvc project and click Edit csproj.

                          2. If you are adding files under wwwroot, just move them to a folder under wwwroot, let's say it "theme"


                          And delete all content tags in csproj file if their exists, an example;



                          <Content Include="wwwrootthemefavicon.ico" />
                          <Content Include="wwwrootthemefontscyrillic-ext400.woff2" />
                          <Content Include="wwwrootthemefontscyrillic-ext700.woff2" />


                          And only add this;



                            <ItemGroup>
                          <Folder Include="wwwroottheme" />
                          </ItemGroup>


                          So, csproj file should be look like this;



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

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

                          <PropertyGroup>
                          <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
                          </PropertyGroup>

                          <ItemGroup>
                          <Folder Include="wwwroottheme" />
                          </ItemGroup>
                          <ItemGroup>
                          <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
                          ...


                          With that way, I think you are adding all files under theme folder. So not include them one by one which occours some erros.






                          share|improve this answer
























                            1












                            1








                            1






                            I found a different proper solution.




                            1. Right click on your mvc project and click Edit csproj.

                            2. If you are adding files under wwwroot, just move them to a folder under wwwroot, let's say it "theme"


                            And delete all content tags in csproj file if their exists, an example;



                            <Content Include="wwwrootthemefavicon.ico" />
                            <Content Include="wwwrootthemefontscyrillic-ext400.woff2" />
                            <Content Include="wwwrootthemefontscyrillic-ext700.woff2" />


                            And only add this;



                              <ItemGroup>
                            <Folder Include="wwwroottheme" />
                            </ItemGroup>


                            So, csproj file should be look like this;



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

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

                            <PropertyGroup>
                            <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
                            </PropertyGroup>

                            <ItemGroup>
                            <Folder Include="wwwroottheme" />
                            </ItemGroup>
                            <ItemGroup>
                            <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
                            ...


                            With that way, I think you are adding all files under theme folder. So not include them one by one which occours some erros.






                            share|improve this answer












                            I found a different proper solution.




                            1. Right click on your mvc project and click Edit csproj.

                            2. If you are adding files under wwwroot, just move them to a folder under wwwroot, let's say it "theme"


                            And delete all content tags in csproj file if their exists, an example;



                            <Content Include="wwwrootthemefavicon.ico" />
                            <Content Include="wwwrootthemefontscyrillic-ext400.woff2" />
                            <Content Include="wwwrootthemefontscyrillic-ext700.woff2" />


                            And only add this;



                              <ItemGroup>
                            <Folder Include="wwwroottheme" />
                            </ItemGroup>


                            So, csproj file should be look like this;



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

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

                            <PropertyGroup>
                            <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
                            </PropertyGroup>

                            <ItemGroup>
                            <Folder Include="wwwroottheme" />
                            </ItemGroup>
                            <ItemGroup>
                            <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
                            ...


                            With that way, I think you are adding all files under theme folder. So not include them one by one which occours some erros.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 19 '17 at 14:08









                            Lost_In_Library

                            1,55521852




                            1,55521852























                                0














                                Excluding and Including back the folders that have duplicates error worked for me! Hope this helps someone else!






                                share|improve this answer


























                                  0














                                  Excluding and Including back the folders that have duplicates error worked for me! Hope this helps someone else!






                                  share|improve this answer
























                                    0












                                    0








                                    0






                                    Excluding and Including back the folders that have duplicates error worked for me! Hope this helps someone else!






                                    share|improve this answer












                                    Excluding and Including back the folders that have duplicates error worked for me! Hope this helps someone else!







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Aug 16 '17 at 19:11









                                    revobtz

                                    34549




                                    34549























                                        0














                                        I think what disabling "EnableDefaultContentItems" isn't the best option.
                                        Manual cs-Proj file editing also isn't the good idea at all.



                                        So for our build server pipeline, we wrote very small tool what will remove all duplicated entries automatically:
                                        dotnet-csproj-cleaner



                                        We run it under Docker as the first build step in our continuous integration pipeline.






                                        share|improve this answer




























                                          0














                                          I think what disabling "EnableDefaultContentItems" isn't the best option.
                                          Manual cs-Proj file editing also isn't the good idea at all.



                                          So for our build server pipeline, we wrote very small tool what will remove all duplicated entries automatically:
                                          dotnet-csproj-cleaner



                                          We run it under Docker as the first build step in our continuous integration pipeline.






                                          share|improve this answer


























                                            0












                                            0








                                            0






                                            I think what disabling "EnableDefaultContentItems" isn't the best option.
                                            Manual cs-Proj file editing also isn't the good idea at all.



                                            So for our build server pipeline, we wrote very small tool what will remove all duplicated entries automatically:
                                            dotnet-csproj-cleaner



                                            We run it under Docker as the first build step in our continuous integration pipeline.






                                            share|improve this answer














                                            I think what disabling "EnableDefaultContentItems" isn't the best option.
                                            Manual cs-Proj file editing also isn't the good idea at all.



                                            So for our build server pipeline, we wrote very small tool what will remove all duplicated entries automatically:
                                            dotnet-csproj-cleaner



                                            We run it under Docker as the first build step in our continuous integration pipeline.







                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited Aug 17 '17 at 11:11









                                            ankit suthar

                                            2,25562041




                                            2,25562041










                                            answered Aug 17 '17 at 10:15









                                            anakod

                                            494




                                            494























                                                0














                                                .NET Core Projects



                                                If you are in a class library, probably you'll need to remove all Compile/Content elements from your csproj as those are included automatically.



                                                <Project Sdk="Microsoft.NET.Sdk">    
                                                <PropertyGroup>
                                                <TargetFramework>netcoreapp2.0</TargetFramework>
                                                </PropertyGroup>
                                                <!-- NEEDED -->
                                                <ItemGroup>
                                                <ProjectReference />
                                                <ProjectReference />
                                                </ItemGroup>
                                                <!-- NOT NEEDED -->
                                                <ItemGroup>
                                                <Compile Include="ModelsExampleClass.cs" />
                                                <Content ... />
                                                </ItemGroup>
                                                </Project>





                                                share|improve this answer


























                                                  0














                                                  .NET Core Projects



                                                  If you are in a class library, probably you'll need to remove all Compile/Content elements from your csproj as those are included automatically.



                                                  <Project Sdk="Microsoft.NET.Sdk">    
                                                  <PropertyGroup>
                                                  <TargetFramework>netcoreapp2.0</TargetFramework>
                                                  </PropertyGroup>
                                                  <!-- NEEDED -->
                                                  <ItemGroup>
                                                  <ProjectReference />
                                                  <ProjectReference />
                                                  </ItemGroup>
                                                  <!-- NOT NEEDED -->
                                                  <ItemGroup>
                                                  <Compile Include="ModelsExampleClass.cs" />
                                                  <Content ... />
                                                  </ItemGroup>
                                                  </Project>





                                                  share|improve this answer
























                                                    0












                                                    0








                                                    0






                                                    .NET Core Projects



                                                    If you are in a class library, probably you'll need to remove all Compile/Content elements from your csproj as those are included automatically.



                                                    <Project Sdk="Microsoft.NET.Sdk">    
                                                    <PropertyGroup>
                                                    <TargetFramework>netcoreapp2.0</TargetFramework>
                                                    </PropertyGroup>
                                                    <!-- NEEDED -->
                                                    <ItemGroup>
                                                    <ProjectReference />
                                                    <ProjectReference />
                                                    </ItemGroup>
                                                    <!-- NOT NEEDED -->
                                                    <ItemGroup>
                                                    <Compile Include="ModelsExampleClass.cs" />
                                                    <Content ... />
                                                    </ItemGroup>
                                                    </Project>





                                                    share|improve this answer












                                                    .NET Core Projects



                                                    If you are in a class library, probably you'll need to remove all Compile/Content elements from your csproj as those are included automatically.



                                                    <Project Sdk="Microsoft.NET.Sdk">    
                                                    <PropertyGroup>
                                                    <TargetFramework>netcoreapp2.0</TargetFramework>
                                                    </PropertyGroup>
                                                    <!-- NEEDED -->
                                                    <ItemGroup>
                                                    <ProjectReference />
                                                    <ProjectReference />
                                                    </ItemGroup>
                                                    <!-- NOT NEEDED -->
                                                    <ItemGroup>
                                                    <Compile Include="ModelsExampleClass.cs" />
                                                    <Content ... />
                                                    </ItemGroup>
                                                    </Project>






                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered Nov 6 '17 at 11:14









                                                    Razvan Dumitru

                                                    4,18531734




                                                    4,18531734























                                                        0














                                                        I had the same problem with only a file, and all others were working (all my templates were stored directly in wwwroot/content). The project was not created by me so I don't know many details.



                                                        The problem was fixed by renaming back and forth the file with the issue:



                                                        MyTemplate.html -- renamed --> MyTemplate2.html -- renamed --> MyTemplate.html



                                                        Note: At the first rename I got an error with something along the lines of "content configuration not found", but the second rename worked without issues.



                                                        After this I was able to compile the project successfully.






                                                        share|improve this answer


























                                                          0














                                                          I had the same problem with only a file, and all others were working (all my templates were stored directly in wwwroot/content). The project was not created by me so I don't know many details.



                                                          The problem was fixed by renaming back and forth the file with the issue:



                                                          MyTemplate.html -- renamed --> MyTemplate2.html -- renamed --> MyTemplate.html



                                                          Note: At the first rename I got an error with something along the lines of "content configuration not found", but the second rename worked without issues.



                                                          After this I was able to compile the project successfully.






                                                          share|improve this answer
























                                                            0












                                                            0








                                                            0






                                                            I had the same problem with only a file, and all others were working (all my templates were stored directly in wwwroot/content). The project was not created by me so I don't know many details.



                                                            The problem was fixed by renaming back and forth the file with the issue:



                                                            MyTemplate.html -- renamed --> MyTemplate2.html -- renamed --> MyTemplate.html



                                                            Note: At the first rename I got an error with something along the lines of "content configuration not found", but the second rename worked without issues.



                                                            After this I was able to compile the project successfully.






                                                            share|improve this answer












                                                            I had the same problem with only a file, and all others were working (all my templates were stored directly in wwwroot/content). The project was not created by me so I don't know many details.



                                                            The problem was fixed by renaming back and forth the file with the issue:



                                                            MyTemplate.html -- renamed --> MyTemplate2.html -- renamed --> MyTemplate.html



                                                            Note: At the first rename I got an error with something along the lines of "content configuration not found", but the second rename worked without issues.



                                                            After this I was able to compile the project successfully.







                                                            share|improve this answer












                                                            share|improve this answer



                                                            share|improve this answer










                                                            answered Jun 11 '18 at 17:01









                                                            Razvan

                                                            54




                                                            54























                                                                0














                                                                My case I is disable bot below default items.



                                                                <EnableDefaultContentItems>false</EnableDefaultContentItems>
                                                                <EnableDefaultItems>false</EnableDefaultItems>





                                                                share|improve this answer


























                                                                  0














                                                                  My case I is disable bot below default items.



                                                                  <EnableDefaultContentItems>false</EnableDefaultContentItems>
                                                                  <EnableDefaultItems>false</EnableDefaultItems>





                                                                  share|improve this answer
























                                                                    0












                                                                    0








                                                                    0






                                                                    My case I is disable bot below default items.



                                                                    <EnableDefaultContentItems>false</EnableDefaultContentItems>
                                                                    <EnableDefaultItems>false</EnableDefaultItems>





                                                                    share|improve this answer












                                                                    My case I is disable bot below default items.



                                                                    <EnableDefaultContentItems>false</EnableDefaultContentItems>
                                                                    <EnableDefaultItems>false</EnableDefaultItems>






                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered Nov 13 '18 at 3:00









                                                                    Duy Hoang

                                                                    12




                                                                    12






























                                                                        draft saved

                                                                        draft discarded




















































                                                                        Thanks for contributing an answer to Stack Overflow!


                                                                        • Please be sure to answer the question. Provide details and share your research!

                                                                        But avoid



                                                                        • Asking for help, clarification, or responding to other answers.

                                                                        • Making statements based on opinion; back them up with references or personal experience.


                                                                        To learn more, see our tips on writing great answers.





                                                                        Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                                        Please pay close attention to the following guidance:


                                                                        • Please be sure to answer the question. Provide details and share your research!

                                                                        But avoid



                                                                        • Asking for help, clarification, or responding to other answers.

                                                                        • Making statements based on opinion; back them up with references or personal experience.


                                                                        To learn more, see our tips on writing great answers.




                                                                        draft saved


                                                                        draft discarded














                                                                        StackExchange.ready(
                                                                        function () {
                                                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43325916%2fduplicate-content-items-were-included-the-net-sdk-includes-content-items-f%23new-answer', 'question_page');
                                                                        }
                                                                        );

                                                                        Post as a guest















                                                                        Required, but never shown





















































                                                                        Required, but never shown














                                                                        Required, but never shown












                                                                        Required, but never shown







                                                                        Required, but never shown

































                                                                        Required, but never shown














                                                                        Required, but never shown












                                                                        Required, but never shown







                                                                        Required, but never shown







                                                                        Popular posts from this blog

                                                                        Bressuire

                                                                        Vorschmack

                                                                        Quarantine