Build on OSX/Unix failing since the build-tool upgrade to 'prerelease-00069'
running build.sh on OSX is failing at the task PrereleaseResolveNuGetPackageAssets for each project. Build was fine for the build-tool version of prerelease-00064.
The stack trace is as follows:
/Users/kapilash/src/corefx/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00069/lib/packageresolve.targets(73,5): error MSB4061: The "PrereleaseResolveNuGetPackageAssets" task could not be instantiated from "/Users/kapilash/src/corefx/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00069/lib/Microsoft.DotNet.Build.Tasks.dll". [/Users/kapilash/src/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj]
/Users/kapilash/src/corefx/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00069/lib/packageresolve.targets(73,5): error MSB4061: System.NullReferenceException: Object reference not set to an instance of an object [/Users/kapilash/src/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj]
/Users/kapilash/src/corefx/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00069/lib/packageresolve.targets(73,5): error MSB4061: at Microsoft.DotNet.Build.Tasks.PrereleaseResolveNuGetPackageAssets..ctor () <0x32c8578 + 0x002c4> in <filename unknown>:0 [/Users/kapilash/src/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj]
/Users/kapilash/src/corefx/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00069/lib/packageresolve.targets(73,5): error MSB4061: at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&) [/Users/kapilash/src/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj]
/Users/kapilash/src/corefx/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00069/lib/packageresolve.targets(73,5): error MSB4061: at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) <0x1a52de0 + 0x00040> in <filename unknown>:0 [/Users/kapilash/src/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj]
/Users/kapilash/src/corefx/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00069/lib/packageresolve.targets(73,5): error MSB4060: The "PrereleaseResolveNuGetPackageAssets" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name. [/Users/kapilash/src/corefx/src/Microsoft.Csharp/src/Microsoft.CSharp.csproj]
Same problem with both 4.0.2 as well as 4.2.0 versions of mono. (OS version 10.10.4, Yosemite)
dotnet/corefx#2609 broke all Unix builds- set before this and building works fine. @mellinoe
Presumably this change broke things:
https://github.com/dotnet/buildtools/pull/218
FWIW, I just commented out the Log statements from PrereleaseResolveNuGetPackageAssets.cs , replaced the resultant dll in the packages folder to get past the issue.
The dll in case you need can be obtained here. It was built on windows.
@FiveTimesTheFun Can you look at this? It appears to have come from your change. dotnet/buildtools#218
Sure, will do. For what its worth, the code came from a later version of the production ResolveNuGetPackageAssets task. This may be a problem if we adopt the upstream version.
I'm suffered from the same issue.
This 'RuntimeIdentifier="win7-x86"' looked suspiscious to me: https://github.com/dotnet/buildtools/pull/218/files#diff-f64b8cc90eaa0611e50e306fb1918244R33
The crasher seems to be PrereleaseResolveNuGetPackageAssets.ctor(), so I looked into that code. And this smelled. https://github.com/dotnet/buildtools/pull/218/files#diff-3bb19c9cf0b9fb2a765b49b9c0c2a5feR43
TryGetRuntimeVersion() invokes NativeMethods.GetFileVersion() https://github.com/dotnet/buildtools/pull/218/files#diff-3bb19c9cf0b9fb2a765b49b9c0c2a5feR627
which P/Invokes to mscoree: https://github.com/dotnet/buildtools/pull/218/files#diff-8e66bdb8eedec92ae5a666903549f9abR22
It won't work outside Windows or coreclr, if that's the case.
Since buildtools is pulled from myget if I understand correctly, I don't know how to examine my assumption.
I came to the same conclusion as @atsushieno.
MSBuild has an implementation of a managed version reader to solve the same problem on !Windows: https://github.com/Microsoft/msbuild/blob/29be71334cb0d660fb077766f2604d3355628097/src/XMakeTasks/AssemblyDependency/AssemblyInformation.cs#L373
cc @ericstj @nguerrera thoughts on this issue? More generally it looks like we will always need to keep a copy of this task for our x-plat builds, so perhaps the name Prerelease in the PrereleaseResolveNuGetPackageAssets name isn't correct.
We should update to the RTM codebase of the task and change the name back IMO, potentially even getting rid of our custom targets in favor of the inbox ones if they are available. We don't have a good reason to be different here. I outlined this in https://github.com/dotnet/corefx/issues/2427
Till we have a permanent fix, here's the same patch for build version 79. Replacing the following dll with this one ,while renaming appropriately, should unblock your build.
packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00079/lib/Microsoft.DotNet.Build.Tasks.dll
Fixed with BuildTools 85 (7f51556d324b5bfdca886be38f8b3a0db70c571a).
FreeBSD needs another update of dnx to at least beta7. Discussion about that is tracked in the follow up issue dotnet/corefx#3173.