简体   繁体   中英

aspnet_compiler.exe finding multiple types in global alias, but I can't!

Inheriting a new project today, trying to make hundreds of warnings go away, and stumped on this. ASP.NET MVC 2, framework 4.0 project which compiles just fine in VS2010, but when the build process hands off to aspnet_compiler.exe, I get the following (cut and pasted from the Output window):

AfterBuild:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v temp -p C:\data\crecare\CreCare20110403\CreCare.Mvc\\..\CreCare.Mvc 
ASPNETCOMPILER : warning CS1685: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll'

Both a search in the Object Browser and a tedious assembly-by-assembly review of the references in the project do not turn up any multiple definition. As far as I can tell the previous team did not try to build any extensions in previous ASP.NET versions ( one cause of this error, I have learned ); I think this has targeted 4.0 from the start.

It's only a warning and I suppose I can ignore it (you can't even /nowarn with aspnet_compiler.exe, so I have to look at them) -- but it rubs me wrong. Any suggestions for how to hunt this down? Should that "\\..\\" in the path to the project worry me? I'm running 64-bit windows; it's not looking at the x86 and 64 at the same time?

It's worth noting that the using the Object Browser in VS2010 in the solution only finds the type in the assembly that aspnet_compiler.exe finds; a search for the type only gives one result. Is aspnet_compiler.exe looking in places that VS2010 doesn't?

Just like you said this is due to Mono.Cecil.

This warning can become an error if you do have a reference to Mono.Cecil.Dll and implement extension methods / because when doing the compiler gives precedence to the Mono.Cecil implementation.

I don't get why db4o assemblies that are supposed to be for .net 4 are not taking this into account, but we can confirm the same as we've looked into the same issue.

As long as you only copy to output the Mono.Cecil (we add as a link and set it to copy to output) instead of using a normal reference, all works fine. The warning is annoying, but given the weird situation around these assemblies on db4o, we preferred not dealing with building its source for now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM