[Mono-dev] Mono.Posix Cross Compiling

Edward Ned Harvey (mono) edward.harvey.mono at clevertrove.com
Tue Jan 6 13:39:12 UTC 2015

> From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-
> bounces at lists.ximian.com] On Behalf Of David Curylo
> If you edit the .csproj file, you can have a platform-specific reference
> Mono.Posix like this:
> <Reference Include="Mono.Posix" Condition=" '$(OS)' != 'Windows_NT' " />

I've never gotten this to work before.  Moments ago, I pasted the above into a test project, just to see if the above would work - and it didn't.  The reference is still present, and still broken, if I open a project with the above line in Visual Studio.  Fortunately as long as you don't use anything from the missing assembly, the project still builds, so in some cases you can ignore the broken reference by using [Conditional] and/or #if to wrap around all the things that actually use something from that assembly...

The workaround I've always settled on was to make multiple versions of the .sln and .csproj files if I need different assemblies referenced on .Net and mono.  (Which is usually the case, because of NUnit and Mono.Security, which I use a lot.)  If you find a way to make the conditional reference functional, please post.  I'd love to know.

More information about the Mono-devel-list mailing list