Skip to content

Commit 7dc6657

Browse files
committed
[tests] Copy and invoke NuGet.exe from subfolder
`NuGet.exe` throws on macOS when it is invoked from the same folder as `Xunit.NetCore.Extensions.dll`: mono bin/TestRelease/NuGet.exe VTable setup of type Xunit.NetCore.Extensions.SkippedTestCase failed System.TypeLoadException: VTable setup of type Xunit.NetCore.Extensions.SkippedTestCase failed at (wrapper managed-to-native) System.RuntimeType.GetPropertiesByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,System.RuntimeType/MemberListType) at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.RuntimeType+MemberListType listType, System.RuntimeType reflectedType) [0x0001b] in <7d0bc631cadd4a07bf74717847e90cfa>:0 at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in <7d0bc631cadd4a07bf74717847e90cfa>:0 at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in <7d0bc631cadd4a07bf74717847e90cfa>:0 at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo+<GetExportMembers>d__32.MoveNext () [0x000eb] in <5e20d4aa8c6c44a89bf1aeb3c06f166c>:0 at System.Linq.Enumerable.Any[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00015] in <e22351e395f44d7b8c4860fca2dcee71>:0 ... Move the copy of `NuGet.exe`into it's own folder to avoid this wierd behavior when executing `Xamarin.Android.Build.Tests.dll` on macOS.
1 parent f7d125a commit 7dc6657

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/XamarinProject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public virtual void NuGetRestore (string directory, string packagesDirectory = n
330330
return;
331331

332332
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
333-
var nuget = Path.Combine (Root, "NuGet.exe");
333+
var nuget = Path.Combine (Root, "nuget", "NuGet.exe");
334334
var psi = new ProcessStartInfo (isWindows ? nuget : "mono") {
335335
Arguments = $"{(isWindows ? "" : "\"" + nuget + "\"")} restore -Verbosity Detailed -PackagesDirectory \"{Path.Combine (Root, directory, "..", "packages")}\" \"{Path.Combine (Root, directory, "packages.config")}\"",
336336
CreateNoWindow = true,

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
</ItemGroup>
144144
<ItemGroup>
145145
<Content Include="..\..\..\..\.nuget\NuGet.exe">
146+
<Link>nuget\NuGet.exe</Link>
146147
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
147148
</Content>
148149
<Content Include="FrameworkPath.targets">

0 commit comments

Comments
 (0)