jstangroome/NuGetReferenceHintPathRewrite

mono support

Opened this issue · 2 comments

.targets with mono/xbuild in non-Windows OS doesn't recognize PowerShell style .NET assembly usage (because PowerShell is missing?)
NuGet.targets considered non-windows case as below.

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
    <!-- Windows specific commands -->
    <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
    <!-- We need to launch nuget.exe with the mono command if we're not on windows -->
    <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
</PropertyGroup>

It would be great if NuGetReferenceHintPathRewrite.targets also supports non-Windows.

Hi @yongkeecho

The syntax that you've suggested is "PowerShell style .NET assembly usage" is completely unrelated to PowerShell and just a coincidental similarity.

This feature is known as MSBuild Property Functions, introduced in MSBuild 4.0 and only takes a dependency on some .NET Base Class Libraries that should be present in Mono on non-Windows platforms.
http://blogs.msdn.com/b/visualstudio/archive/2010/04/02/msbuild-property-functions.aspx

Sadly it seems XBuild hasn't implement support for Property Functions yet. For the [System.IO.Path]::Combine usage a change could be made to join paths more naively. However for the Regex usage I'm not aware of an equivalent aside from rewriting the functionality in C#, compiling it and exposing it as an custom MSBuild task.

Regards,

Jason

I came upon that issue while trying to compile my project with mono, and it seems that by now everything is supported, except I had to change the regex to support linuxy slashes:

(?i)^(.+[\/\\)?packages[\/\\]

#7