Skip to content

System.MissingMethodException: Method not found: 'Void NuGet.Commands.RestoreRequest..ctor( ... )'. #1538

@LordMike

Description

@LordMike

So. This is odd. This worked a few days ago, on both Windows and Linux (ubuntu - docker), but now it works only on Linux.

We're running .NET SDK 2.1.500 (aka 2.1.6), with GitVersionTask 4.0.1-beta1-47. Without GitVersionTask, all builds - but with it we get:

> dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : Task factory warning NMSBT010: There is a mismatch between SDK NuGet version (4.9.0) and the NuGet version the task factory was compiled against (4.8.0). There might occur some exotic errors. [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT001: Exception in initialization: System.MissingMethodException: Method not found: 'Void NuGet.Commands.RestoreRequest..ctor(NuGet.ProjectModel.PackageSpec, NuGet.Commands.RestoreCommandProviders, NuGet.Protocol.Core.Types.SourceCacheContext, NuGet.Common.ILogger)'. [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT001:    at UtilPack.NuGet.BoundRestoreCommandUser.PerformRestore(ValueTuple`2[] targets, CancellationToken token) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT001:    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT001:    at UtilPack.NuGet.BoundRestoreCommandUser.PerformRestore(ValueTuple`2[] targets, CancellationToken token) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT001:    at UtilPack.NuGet.BoundRestoreCommandUser.RestoreIfNeeded(CancellationToken token, ValueTuple`2[] packageInfo) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT001:    at UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory.Initialize(String taskName, IDictionary`2 parameterGroup, String taskBody, IBuildEngine taskFactoryLoggingHost) [C:\Src\Project.csproj]
C:\Users\MichaelBisbjerg\.nuget\packages\gitversiontask\4.0.1-beta1-47\build\functionality\GitVersionMultiTargetBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\MichaelBisbjerg\.nuget\packages\utilpack.nuget.msbuild\2.7.0\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Object reference not set to an instance of an object. [C:\Src\Project.csproj]

Updating UtilPack.NuGet.MSBuild to 2.9.0 gives:

> dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : Task factory error NMSBT000: Failed to load actual task factory assembly System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\MichaelBisbjerg\.nuget\packages\utilpack.nuget.msbuild\2.9.0\buildMultiTargeting\build\netcoreapp1.1'. [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT000:    at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT000:    at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, EnumerationOptions options) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT000:    at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT000:    at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT000:    at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT000:    at UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory.GetNewestAvailableTaskFactoryVersion(String thisDir, String thisName) [C:\Src\Project.csproj]
MSBUILD : Task factory error NMSBT000:    at UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory..ctor(). [C:\Src\Project.csproj]
C:\Users\MichaelBisbjerg\.nuget\packages\gitversiontask\4.0.1-beta1-47\build\functionality\GitVersionMultiTargetBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\MichaelBisbjerg\.nuget\packages\utilpack.nuget.msbuild\2.9.0\buildMultiTargeting\\..\build\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Object reference not set to an instance of an object. [C:\Src\Project.csproj]

On an Ubuntu linux (docker), the build is fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions