GitVersion: MSBUILD : Task factory warning NMSBT010: There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.8.0). There might occur some exotic errors.

Hello,

Issue strikes back with new dotnet core sdk (i’m using 2.2.101). Warning is followed by an error:

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:\Users\mjasni\source\repos\PokInvoices\InvoicesApp\InvoicesApp.csproj]
MSBUILD : Task factory error NMSBT001:    at UtilPack.NuGet.BoundRestoreCommandUser.PerformRestore(ValueTuple`2[] targets, CancellationToken token) [C:\Users\mjasni\source\repos\PokInvoices\InvoicesApp\InvoicesApp.csproj]
MSBUILD : Task factory error NMSBT001:    at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) [C:\Users\mjasni\source\repos\PokInvoices\InvoicesApp\InvoicesApp.csproj]
MSBUILD : Task factory error NMSBT001:    at UtilPack.NuGet.BoundRestoreCommandUser.PerformRestore(ValueTuple`2[] targets, CancellationToken token) [C:\Users\mjasni\source\repos\PokInvoices\InvoicesApp\InvoicesApp.csproj]
MSBUILD : Task factory error NMSBT001:    at UtilPack.NuGet.BoundRestoreCommandUser.RestoreIfNeeded(CancellationToken token, ValueTuple`2[] packageInfo) [C:\Users\mjasni\source\repos\PokInvoices\InvoicesApp\InvoicesApp.csproj]
MSBUILD : Task factory error NMSBT001:    at UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory.Initialize(String taskName, IDictionary`2 parameterGroup, String taskBody, IBuildEngine taskFactoryLoggingHost) [C:\Users\mjasni\source\repos\PokInvoices\InvoicesApp\InvoicesApp.csproj]
C:\Users\mjasni\.nuget\packages\gitversiontask\4.0.0\build\functionality\GitVersionBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\mjasni\.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. 

Best regards, Maciej

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 34 (19 by maintainers)

Most upvoted comments

@arturcic I can try at least. I’ll do the forking and working on it once all my tests work fine in NuGetUtils repo. 😃 I’ll write here if I bump into something that I can’t solve by myself.

Hi @adstep and others,

I’ve been working on this issue for a bit now. The work is going on in https://github.com/stazz/NuGetUtils repository, and after that, some work needs to be done for GitVersion task to be compatible with the changes. Once that is done, the whole reason for this issue will disappear.

It’s hard to give any estimates, but major part of the work in NuGetUtils repository is already done, and I don’t foresee any big design- or implementation-level troubles ahead of me.

beta1-51 works for me currently, but not later or earlier versions

On Fri, Jan 11, 2019, 7:53 AM Vasili Puchko notifications@github.com wrote:

Also encountering the same issue with beta1-58. I’m trying to run dotnet pack for libraries targeting .Net Core 2.1. Any workarounds or ideas how that can be fixed?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GitTools/GitVersion/issues/1554#issuecomment-453507911, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD0bThM6_BUpyy3l0yGMGJ_y_1iEjzWks5vCIlKgaJpZM4ZWCsM .

Well usually it’s easier to create a feature branch for the PR, and that’s the recommended approach. There are some checks in the build script if it’s the main branch or not, and depending on that we build in a way or another, so I suggest just create a feature branch

Hi! The status currently is that I just yesterday got the NuGetUtils.MSBuild.Exec package in such state that it actually builds completely in CI. I forked this repo and made some preliminary checks to it. At first glance I don’t expect very big changes, but of course, you never know until you’ve done it. 😃

I do have one question tho: While I dev my fork, what is the suggested approach to test that everything still works? I see there are appveyor.yml and .travis.yml files, are those up-to-date and have a test suites for actually using GitVersionTask from within MSBuild, by utilizing UtilPack (which now is NuGetUtils.MSBuild.Exec)? If I e.g. add the forked repo as my project on AppVeyor, will the build and test process work out of the box and the tests will verify that stuff works on MSBuild?

@JeremyCaney Since my earlier comment, I found that no version works with dotnet-sdk-2.2. It’s just broken. beta1-51 works with dotnet-sdk-2.1.

Resolved by #1677.

Furthermore, I’ve tried the latest beta version (4.0.1-beta1-53), which targets Utilpack 2.9.1:

error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\mjasni\.nuget\packages\utilpack.nuget.msbuild\2.9.1\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Assembly with same name is already loaded

My Project targets net462 due to some libraries that we’re required to use, but we use aspnetcore (wanted to upgrade to 2.2 when faced the issue). I’d appreciate any suggestions how to fix the issue.