NuGet Package Restore Using Nugets Targets on Mono With Xbuild

NuGet package restore does work on Mono with xbuild, but you may find some nix builds fail because the imported target that uses $(SolutionDir) fails on Mono due to a double forward-slash in the path. As xbuild doesn’t support property functions I found this crued solution ensures Visual Studio doesn’t re-add the import line but does allow xbuild on nix to complete.

<Import Condition="$(MSBuildProgramFiles32) == ''" Project="$(SolutionDir).nuget\nuget.targets" />
<Import Condition="$(MSBuildProgramFiles32) != ''" Project="$(SolutionDir)\.nuget\nuget.targets" />

If you’ve found a better solution let me know :–)