Bug 31628 - ItemGroup Compile with wildcard expansion warning 'Source File specified mutiple times'
Summary: ItemGroup Compile with wildcard expansion warning 'Source File specified muti...
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Tools
Classification: Mono
Component: xbuild (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 35847 48954 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-03 11:54 UTC by diegobfernandez
Modified: 2018-03-15 10:39 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description diegobfernandez 2015-07-03 11:54:57 UTC
I have the following in a csproj file (The only Compile directive in all csproj):

<ItemGroup>
  <Compile Include="**\*.cs" />
</ItemGroup>

This works as far as I have tested but the compiler output warnings about source files specified multiple times.

CSC:  warning CS2002: Source file `obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs' specified multiple times
CSC:  warning CS2002: Source file `Modules/ProdutoModule.cs' specified multiple times
CSC:  warning CS2002: Source file `Modules/SampleModule.cs' specified multiple times
CSC:  warning CS2002: Source file `obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs' specified multiple times
CSC:  warning CS1701: Assuming assembly reference `System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' matches assembly `System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. You may need to supply runtime policy
Modules/ProdutoModule.cs(9,45): warning CS0414: The private field `Alcance.Web.ProdutoModule._dbConnectionFactory' is assigned but its value is never used

I also noticed the command runned have these files duplicated:

Tool /usr/lib/mono/4.5/mcs.exe execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/Alcance.Web.dll Modules/ProdutoModule.cs Modules/SampleModule.cs obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs Modules/ProdutoModule.cs Modules/SampleModule.cs obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs AlcanceConnectionStringFactory.cs /target:library /define:DEBUG /nostdlib /reference:/usr/lib/mono/4.5/System.dll /reference:/usr/lib/mono/4.5/System.Web.dll /reference:/usr/lib/mono/4.5/System.Xml.dll /reference:/usr/lib/mono/4.5/System.Web.Services.dll /reference:../packages/Nancy.1.2.0/lib/net40/Nancy.dll /reference:../packages/Nancy.Hosting.Aspnet.1.2.0/lib/net40/Nancy.Hosting.Aspnet.dll /reference:../packages/Nancy.Viewengines.Razor.1.2.0/lib/net40/Nancy.ViewEngines.Razor.dll /reference:../packages/Microsoft.AspNet.Razor.3.2.3/lib/net45/System.Web.Razor.dll /reference:/usr/lib/mono/4.5/System.Configuration.dll /reference:/usr/lib/mono/4.5/System.Core.dll /reference:/home/diego/projects/alcance-alcance/Alcance.Domain/bin/Debug//Alcance.Domain.dll /reference:/home/diego/projects/alcance-alcance/Alcance.Infrastructure/bin/Debug//Alcance.Infrastructure.dll /reference:/usr/lib/mono/4.5/mscorlib.dll /warn:4

The program is running fine but I can't enable warnings as errors on my CI because of this.
Comment 1 diegobfernandez 2015-07-03 11:59:28 UTC
Forgot to add versions.

XBuild Engine Version 12.0
Mono, Version 4.0.2.0
Comment 2 Tom Gilder 2015-10-08 10:28:18 UTC
Any update on this? I've just hit it, pretty annoying
Comment 3 Marcin Wieczorek 2016-02-03 12:21:54 UTC
Still not fixed in 2016 :(
The same issue is reported also here: https://bugzilla.xamarin.com/show_bug.cgi?id=35847
Comment 4 Mikayla Hutchinson [MSFT] 2016-02-04 01:07:22 UTC
*** Bug 35847 has been marked as a duplicate of this bug. ***
Comment 5 Erik Schierboom 2016-08-14 13:11:55 UTC
Same bug here. Wilcard compile issues the CSC:  warning CS2002: Source file warning.
Comment 6 Vincent Dondain [MSFT] 2016-12-15 22:39:03 UTC
*** Bug 48954 has been marked as a duplicate of this bug. ***
Comment 7 alex 2017-10-27 17:49:22 UTC
Any updates on this issue?
Comment 8 Marek Safar 2018-03-15 10:39:53 UTC
We deprecated xbuild and recommend using msbuild instead. Switching to msbuild will also most likely resolve the issue you reported.