Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do these Mono/xbuild warnings mean and how do I fix them?

Tags:

mono

xbuild

I build VS2010 projects with Mono's xbuild 2.10.5.0. The projects use the '.NET Framework 3.5 Client Profile' as the target framework (they must be 3.5 compatible and I don't need more than the client profile parts).

I'm getting the following warnings:

Build succeeded.

Warnings:

c:\Project\MyProject.csproj (default targets) -> C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->
    C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets:  warning : Unable to find framework corresponding to the target framework moniker '.NETFramework,Version=v3.5,Profile=Client'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior.

c:\Project\MyProject.csproj (default targets) -> C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets (ResolveAssemblyReferences target) ->
    C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets:  warning : Reference 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not resolved
    C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets:  warning : Found a conflict between : 'System' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System' reference.
    C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets:  warning : Found a conflict between : 'System.Core' and 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System.Core' reference.

I'm afraid I don't understand these and the only Google hit for "Unable to find framework corresponding to the target framework moniker" is the commit for that error message.

What do these warnings mean and how can I fix them? Is the 'client profile' not supported by Mono at all? If so, I couldn't find anything about that in the Mono documentation. What causes the unresolved mscorlib reference and where are these two System references it reports a conflict between?

like image 455
Henrik Heimbuerger Avatar asked Aug 29 '11 09:08

Henrik Heimbuerger


People also ask

What is xbuild in mono?

xbuild is Mono’s implementation of msbuild and it allows projects that have an msbuild file to be compiled natively on Linux. xbuild has been part of the standard Mono distribution for some time now, but it is not 100% complete yet. xbuild supports C# and VB.NET projects out of the box.

What happens if xbuild is unable to resolve a reference?

If xbuild is unable to resolve a reference, then it logs details of why the various search paths failed. If this variable is set, then it logs the same even for references that were resolved successfully.

What is xbuild in Visual Studio?

xbuild can be used to build MSBuild project files. Integrated Development Environments like MonoDevelop and "Microsoft Visual Studio .NET" use msbuild project file format. xbuild takes the path of the project or solution file to build, as the main argument.


1 Answers

You are guessing correctly - Mono does not support the 'Client' profile (e.g. search Mono version of 3.5 Microsoft.Common.targets for any mention of 'Client'), only the full 3.5 and 4.0 profiles. To fix them, you need to specify one of the supported profiles in your project file. Profile selection only restricts the set of references available during build, an assembly compiled with the 'Client' profile will work on the 'Full' profile just fine.

The mscorlib, Version=2.0.0.0 unresolved reference is happening because you are compiling with a 4.0 profile (which is the default fallback). It will disappear once you set your profile to a supported value. If you do not want to change your project file, you can build with xbuild /p:TargetFrameworkProfile="", which correctly chooses the 3.5 set of assemblies.

like image 128
skolima Avatar answered Sep 18 '22 15:09

skolima