What do these Mono/xbuild warnings mean and how do

2019-04-23 15:06发布

问题:

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?

回答1:

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.



标签: mono xbuild