Skip to content

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. #1554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
czeslav87 opened this issue Dec 17, 2018 · 34 comments

Comments

@czeslav87
Copy link

czeslav87 commented Dec 17, 2018

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

@czeslav87
Copy link
Author

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.

@stazz
Copy link
Contributor

stazz commented Dec 17, 2018

Hi @czeslav87 , can you submit a minimal repro and/or a log with /verbosity set to detailed if not even diagnostic?

Edit: Either here or make an issue on https://github.com/stazz/UtilPack :)

@czeslav87
Copy link
Author

czeslav87 commented Dec 18, 2018

Will do my best to provide repro asap.

@czeslav87
Copy link
Author

GitVersionBugRepro.zip
@stazz Included zip with reproduction and diagnostic log
dotnet build --verbosity diag > log.txt
Repro is blank dotnetcore2.2 console app with GitVersion task. Must run on new .net Core SDK to reproduce bug.

Best regards.

@stazz
Copy link
Contributor

stazz commented Dec 19, 2018

Ah yes, the 4.0.0 version of GitVersionTask will definetly not work on new dotnet, as it uses outdated UtilPack. From the log.txt:

"C:\Users\mjasni\.nuget\packages\gitversiontask\4.0.0\build\functionality\GitVersionBuild.targets" from project "C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj" (target "CoreCompile" depends on it):
                   Initializing task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" from assembly "C:\Users\mjasni\.nuget\packages\utilpack.nuget.msbuild\2.7.0\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll"

Version 2.7.0 is not compatible with newer dotnet versions.

I tried updating to GitVersionTask 4.0.1-beta1-53 which has newest UtilPack dependency, but it seems that it is missing some required stuff in its build/netstandard2.0 folder and/or from .nuspec. I manually downloaded and added libgit2-a904fc6.so and LibGit2Sharp.(dll|pdb|xml) files to the build/netstandard2.0 folder of 4.0.1-beta-53 version of GitVersionTask, and I ended up with:

                   Initializing task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" from assembly "/root/.nuget/packages/utilpack.nuget.msbuild/2.9.1/build/netcoreapp1.1/UtilPack.NuGet.MSBuild.dll".
                   Detected current NuGet framework to be ".NETCoreApp,Version=v2.0", with RID "linux-x64", and local repositories: /root/.nuget/packages/.
                   [NuGet Minimal]: Restoring packages for /root/.nuget/packages/gitversiontask/4.0.1-beta1-53/build/functionality/GitVersionBuild.targets...
                   [NuGet Verbose]: Restoring packages for .NETCoreApp,Version=v2.0...
                   [NuGet Verbose]: Resolving conflicts for .NETCoreApp,Version=v2.0...
                   [NuGet Verbose]: Checking compatibility of packages on .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for Restoring: (GitVersionTask, [4.0.1-beta1-53, )) 1.0.0 with .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for GitVersionTask 4.0.1-beta1-53 with .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for UtilPack.NuGet.MSBuild 2.9.1 with .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for YamlDotNet 5.2.1 with .NETCoreApp,Version=v2.0.
                   [NuGet Verbose]: All packages and projects are compatible with .NETCoreApp,Version=v2.0.
                   [NuGet Minimal]: Restoring packages for /root/.nuget/packages/gitversiontask/4.0.1-beta1-53/build/functionality/GitVersionBuild.targets...
                   [NuGet Verbose]: Restoring packages for .NETCoreApp,Version=v2.0...
                   [NuGet Verbose]: Resolving conflicts for .NETCoreApp,Version=v2.0...
                   [NuGet Verbose]: Checking compatibility of packages on .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for Restoring: (Microsoft.NETCore.App, [2.0.0, )) 1.0.0 with .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for Microsoft.NETCore.App 2.0.0 with .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for Microsoft.NETCore.DotNetHostPolicy 2.0.0 with .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for Microsoft.NETCore.Platforms 2.0.0 with .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for NETStandard.Library 2.0.0 with .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for Microsoft.NETCore.DotNetHostResolver 2.0.0 with .NETCoreApp,Version=v2.0.
                   [NuGet Debug]: Checking compatibility for Microsoft.NETCore.DotNetAppHost 2.0.0 with .NETCoreApp,Version=v2.0.
                   [NuGet Verbose]: All packages and projects are compatible with .NETCoreApp,Version=v2.0.
                   Using "WriteVersionInfoToBuildLog" task from the task factory "NuGetTaskRunnerFactory".
                   Task "WriteVersionInfoToBuildLog" (TaskId:57)
                     Task Parameter:SolutionDirectory=/code/GitVersionBugRepro (TaskId:57)
                     Task Parameter:NoFetch=false (TaskId:57)
                     Resolved GitVersionTask, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null located in /root/.nuget/packages/gitversiontask/4.0.1-beta1-53/build/netstandard2.0/GitVersionTask.dll and loaded from same path. (TaskId:57)
                     Resolved GitVersionCore, Version=4.0.1.0, Culture=neutral, PublicKeyToken=null located in /root/.nuget/packages/gitversiontask/4.0.1-beta1-53/build/netstandard2.0/GitVersionCore.dll and loaded from same path. (TaskId:57)
                     Resolved GitTools.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null located in /root/.nuget/packages/gitversiontask/4.0.1-beta1-53/build/netstandard2.0/GitTools.Core.dll and loaded from same path. (TaskId:57)
                     Resolved LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333 located in /root/.nuget/packages/gitversiontask/4.0.1-beta1-53/build/netstandard2.0/LibGit2Sharp.dll and loaded from same path. (TaskId:57)
                     Failed to resolve unmanaged assembly "git2-a904fc6", with all seen unmanaged DLL paths: . (TaskId:57)
                     Failed to resolve unmanaged assembly "git2-a904fc6", with all seen unmanaged DLL paths: . (TaskId:57)
                     Failed to resolve unmanaged assembly "git2-a904fc6", with all seen unmanaged DLL paths: . (TaskId:57)
                     Failed to resolve unmanaged assembly "git2-a904fc6", with all seen unmanaged DLL paths: . (TaskId:57)

So it successfully used NuGet API to restore the package, and started running it. It failed to load the managed assembly, but that is due the fact that it was not really part of any NuGet package, as I manually copied it. But I think this is one thing that definetly will need some improving - smarter native package dependency resolution.

In any case, this seems to be more about version 4.0.1-beta1-53 of GitVersionTask not to have LibGit2Sharp dependency in its .nuspec file under .NETStandard2.0 framework dependency specification, and also about UtilPack not being able to pick up on the manually added native library.

Can you confirm you get as far as this with 4.0.1-beta1-53 version of GitVersionTask, after you fully clean repro project, @czeslav87 ?

P.S. The Detected current NuGet framework to be ".NETCoreApp,Version=v2.0" is probably due to the fact that automatic .NET Core App 2.2 deduction does not work since the 2.2 is still so new. It can be overridden tho, and I'll add the auto-deduciton support for 2.2. as well soon. But I think #1537 needs to be at least agreed on how to proceed, before that.

@czeslav87
Copy link
Author

@stazz yes, I'm having the same results with 4.0.1-beta1-53. LibGit2Sharp Is missing

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

  Restore completed in 67,5 ms for C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj.
There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.9.0).
[NuGet Minimal]: Restoring packages for C:\Users\mjasni\.nuget\packages\gitversiontask\4.0.1-beta1-53\build\functionality\GitVersionBuild.targets...
[NuGet Minimal]: Restoring packages for C:\Users\mjasni\.nuget\packages\gitversiontask\4.0.1-beta1-53\build\functionality\GitVersionBuild.targets...
MSBUILD : warning : WARN [12/20/18 9:11:07:93] Could not determine assembly version: System.IO.FileNotFoundException: Could not load file or assembly 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'. The system cannot find the file specified. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333' ---> System.IO.FileNotFoundException: Could not load the specified file. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp' [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.9.0).
MSBUILD : warning : WARN [12/20/18 9:11:08:00] Could not determine assembly version: System.IO.FileNotFoundException: Could not load file or assembly 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'. The system cannot find the file specified. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333' ---> System.IO.FileNotFoundException: Could not load the specified file. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp' [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.9.0).
MSBUILD : warning : WARN [12/20/18 9:11:08:05] Could not determine assembly version: System.IO.FileNotFoundException: Could not load file or assembly 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'. The system cannot find the file specified. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333' ---> System.IO.FileNotFoundException: Could not load the specified file. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp' [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
C:\Program Files\dotnet\sdk\2.2.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.GenerateAssemblyInfo.targets(161,5): error MSB4044: The "GetAssemblyVersion" task was not given a value for the required parameter "NuGetVersion". [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]

Build FAILED.

MSBUILD : warning : WARN [12/20/18 9:11:07:93] Could not determine assembly version: System.IO.FileNotFoundException: Could not load file or assembly 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'. The system cannot find the file specified. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333' ---> System.IO.FileNotFoundException: Could not load the specified file. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp' [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : WARN [12/20/18 9:11:08:00] Could not determine assembly version: System.IO.FileNotFoundException: Could not load file or assembly 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'. The system cannot find the file specified. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333' ---> System.IO.FileNotFoundException: Could not load the specified file. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp' [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : WARN [12/20/18 9:11:08:05] Could not determine assembly version: System.IO.FileNotFoundException: Could not load file or assembly 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'. The system cannot find the file specified. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333' ---> System.IO.FileNotFoundException: Could not load the specified file. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning : File name: 'LibGit2Sharp' [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :  [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
C:\Program Files\dotnet\sdk\2.2.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.GenerateAssemblyInfo.targets(161,5): error MSB4044: The "GetAssemblyVersion" task was not given a value for the required parameter "NuGetVersion". [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
    3 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.51

@stazz
Copy link
Contributor

stazz commented Dec 20, 2018

Fun thing is, if you manually add dependency to the GitVersionTask.nuspec of 4.0.1-beta1-53 version of GitVersionTask, so it will look like this:

    <dependencies>
      <group>
        <dependency id="UtilPack.NuGet.MSBuild" version="2.9.1" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETStandard2.0">
        <dependency id="UtilPack.NuGet.MSBuild" version="2.9.1" exclude="Build,Analyzers" />
        <dependency id="YamlDotNet" version="5.2.1" exclude="Build,Analyzers" />
        <dependency id="LibGit2Sharp" version="0.26.0-preview-0070" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETFramework4.6.1">
        <dependency id="UtilPack.NuGet.MSBuild" version="2.9.1" exclude="Build,Analyzers" />
      </group>
    </dependencies>

There will be no errors. :)

@bonesoul
Copy link

bonesoul commented Jan 3, 2019

same issue here. any fixes?

@stazz
Copy link
Contributor

stazz commented Jan 3, 2019

The GitVersionTask version 4.0.1-beta1-58 seems to have correct .nuspec file.

@bonesoul
Copy link

bonesoul commented Jan 3, 2019

tried that but getting

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

  Restoring packages for E:\Coding\hypeengine\src\hypeengine.cli\hypeengine.cli.csproj...
  Restore completed in 75,47 ms for E:\Coding\hypeengine\src\hypeengine.core\hypeengine.core.csproj.
  Restore completed in 75,47 ms for E:\Coding\hypeengine\src\hypeengine.tests\hypeengine.tests.csproj.
  Generating MSBuild file E:\Coding\hypeengine\src\hypeengine.cli\obj\hypeengine.cli.csproj.nuget.g.props.
  Restore completed in 757,52 ms for E:\Coding\hypeengine\src\hypeengine.cli\hypeengine.cli.csproj.
  hypeengine.core -> E:\Coding\hypeengine\src\hypeengine.core\bin\Debug\netcoreapp2.2\hypeengine.core.dll
C:\Users\shala\.nuget\packages\gitversiontask\4.0.1-beta1-58\build\functionality\GitVersionBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\shala\.nuget\packages\utilpack.nuget.msbuild\2.9.1\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Assembly with same name is already loaded [E:\Coding\hypeengine\src\hypeengine.cli\hypeengine.cli.csproj]
  hypeengine.tests -> E:\Coding\hypeengine\src\hypeengine.tests\bin\Debug\netcoreapp2.2\hypeengine.tests.dll

Build FAILED.

C:\Users\shala\.nuget\packages\gitversiontask\4.0.1-beta1-58\build\functionality\GitVersionBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\shala\.nuget\packages\utilpack.nuget.msbuild\2.9.1\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Assembly with same name is already loaded [E:\Coding\hypeengine\src\hypeengine.cli\hypeengine.cli.csproj]
    0 Warning(s)
    1 Error(s)

@czeslav87
Copy link
Author

4.0.1-beta1-58 on minimal repro:

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

  Restore completed in 63,29 ms for C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj.
There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.9.0).
[NuGet Minimal]: Restoring packages for C:\Users\mjasni\.nuget\packages\gitversiontask\4.0.1-beta1-58\build\functionality\GitVersionBuild.targets...
[NuGet Minimal]: Restoring packages for C:\Users\mjasni\.nuget\packages\gitversiontask\4.0.1-beta1-58\build\functionality\GitVersionBuild.targets...
There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.9.0).
MSBUILD : warning : WARN [01/03/19 15:45:42:80] Could not determine assembly version: System.Runtime.InteropServices.MarshalDirectiveException: StrictFilePathMarshaler must be used on a FilePath. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at LibGit2Sharp.Core.StrictFilePathMarshaler.MarshalManagedToNative(Object managedObj) in C:\projects\libgit2sharp\LibGit2Sharp\Core\FilePathMarshaler.cs:line 71 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.StubHelpers.MngdRefCustomMarshaler.ConvertContentsToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at LibGit2Sharp.Core.NativeMethods.git_repository_discover(GitBuf buf, FilePath start_path, Boolean across_fs, FilePath ceiling_dirs) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 3553 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at LibGit2Sharp.Repository.Discover(String startingPath) in C:\projects\libgit2sharp\LibGit2Sharp\Repository.cs:line 645 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj] MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() in C:\projects\gitversion\src\GitVersionCore\GitPreparer.cs:line 163 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
There is a mismatch between SDK NuGet version (4.9.2) and the NuGet version the task factory was compiled against (4.9.0).
MSBUILD : warning : WARN [01/03/19 15:45:42:89] Could not determine assembly version: System.Runtime.InteropServices.MarshalDirectiveException: StrictFilePathMarshaler must be used on a FilePath. [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at LibGit2Sharp.Core.StrictFilePathMarshaler.MarshalManagedToNative(Object managedObj) in C:\projects\libgit2sharp\LibGit2Sharp\Core\FilePathMarshaler.cs:line 71 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at System.StubHelpers.MngdRefCustomMarshaler.ConvertContentsToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at LibGit2Sharp.Core.NativeMethods.git_repository_discover(GitBuf buf, FilePath start_path, Boolean across_fs, FilePath ceiling_dirs) [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 3553 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at LibGit2Sharp.Repository.Discover(String startingPath) in C:\projects\libgit2sharp\LibGit2Sharp\Repository.cs:line 645 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj] MSBUILD : warning :    at GitVersion.GitPreparer.GetDotGitDirectory() in C:\projects\gitversion\src\GitVersionCore\GitPreparer.cs:line 163 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 33 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication) in C:\projects\gitversion\src\GitVersionCore\ExecuteCore.cs:line 82 [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]
C:\Program Files\dotnet\sdk\2.2.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.GenerateAssemblyInfo.targets(161,5): error MSB4044: The "GetAssemblyVersion" task was not given a value for the required parameter "NuGetVersion". [C:\Users\mjasni\source\repos\GitVersionBugRepro\GitVersionBugRepro\GitVersionBugRepro.csproj]

@stazz
Copy link
Contributor

stazz commented Jan 3, 2019

@bonesoul Have you tried settings /verbosity to detailed? I think that error is originally coming from another.

@czeslav87 It looks like the UtilPack is loading assemblies OK, but first there is a warning about StrictFilePathMarshaler (maybe LibGit2Sharp is missing some new .NET Core feature?), and finally ends up with The "GetAssemblyVersion" task was not given a value for the required parameter "NuGetVersion". Setting /verbosity to detailed would help here too.

Edit: I'll try to get work started related to #1537 this weekend. Hopefully soon it will be possible to lock down NuGet version in .NET Core, thus avoiding quite a lot of confusion as .NET Core versions keep changing.

@czeslav87
Copy link
Author

I've just looked up StrictFilePathMarshaller error, and results led to this #720 . I'll check it out tommorow. I might have had opened two instances of VS with different project with GitVersionTask.

@czeslav87
Copy link
Author

@stazz no luck today. Same errors. I'm attaching detailed log
log_2019-01-04.zip

@stazz
Copy link
Contributor

stazz commented Jan 6, 2019

I took a look in the output logs. Where it says C:\Program Files\dotnet\sdk\2.2.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.GenerateAssemblyInfo.targets(161,5): error MSB4044: The "GetAssemblyVersion" task was not given a value for the required parameter "NuGetVersion". , taking a look in the Microsoft.NET.GenerateAssemblyInfo.targets line 161, shows it passes NuGetVersion parameter as NuGetVersion="$(Version)". So something clears the Version MSBuild property before that, and that something is the failed GetVersion target in gitversiontask\4.0.1-beta1-58\build\functionality\GitVersionBuild.targets:

<PropertyGroup Condition=" '$(UpdateVersionProperties)' == 'true' ">
      <Version>$(GitVersion_FullSemVer)</Version>
      [ and so on ... ]
 </PropertyGroup>

Since the target failed previously (as a warning about StrictFilePathMarshaller), the GitVersion_FullSemVer property is empty, and then the Version property gets assigned as empty as well.

One way to remedy this is to add a guard to the property assigned, like this: <Version Condition=" '$(GitVersion_FullSemVer)' != '' ">$(GitVersion_FullSemVer)</Version>. However, since the target actually fails but is showing as a warning, this might just cause wrong results, when the .csproj builder assumes that GitVersionTask succeeded since the build passes, when it fact it did not.

So the right way to fix this is to make the warning into error. However, I don't know what's going on with StrictFilePathMarshaller error, as it's been 5+ years since I last time used native assemblies from .NET directly.

@JoshSchreuder
Copy link

Similar error here on 4.0.1-beta1-58

Getting

11:39:03 C:\Users\buildserver\.nuget\packages\gitversiontask\4.0.1-beta1-58\build\functionality\GitVersionBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\buildserver\.nuget\packages\utilpack.nuget.msbuild\2.9.1\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Assembly with same name is already loaded

@zihotki
Copy link

zihotki commented Jan 11, 2019

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?

@wjrogers
Copy link
Contributor

wjrogers commented Jan 11, 2019 via email

@acgritt
Copy link

acgritt commented Jan 22, 2019

I am just curious to know if there has been any work done on this as the warning about StrictFilePathMarshaller actually is causing an error with the projects I am working on when I run the build from the command line on Windows with .NET Core 2.2.1. Within Visual Studio all is fine but when I run from the command line to generate the code coverage reports it creates errors unless I apply the workaround suggested by @stazz (thanks by the way).

@JeremyCaney
Copy link
Contributor

JeremyCaney commented Feb 7, 2019

I'm also curious what the status of this is. Unlike @wjrogers, beta1-51 doesn't work for me—nor does the latest beta1-59 from two weeks ago. I'm attempting to run dotnet build for libraries targeting both .NET Framework 4.7 and .NET Standard 2.0. I get the errors…

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\User\.nuget\packages\utilpack.nuget.msbuild\2.9.1\buildMultiTargeting\build\netcoreapp1.1'.

C:\Users\User\.nuget\packages\gitversiontask\4.0.1-beta1-51\build\functionality\GitVersionMultiTargetBuild.targets(6,5): error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "C:\Users\User\.nuget\packages\utilpack.nuget.msbuild\2.9.1\buildMultiTargeting\\..\build\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Object reference not set to an instance of an object.

Perhaps naively (?) I would assume this has something to do with the UtilPackNuGetMSBuildToolsRootPath reference in the buildMultiTargeting\UtilPack.NuGet.MSBuild.props file…

<UtilPackNuGetMSBuildToolsRootPath Condition=" '$(UtilPackNuGetMSBuildToolsRootPath)' == '' ">$(MSBuildThisFileDirectory)\..\build\</UtilPackNuGetMSBuildToolsRootPath>

…since that's presumably what's resulting in the \buildMultiTargeting\\..\build reference. That said, the above thread seems to suggest that something else is going on…? It's worth noting that this works fine using msbuild /t:build—it's only when using dotnet build that I encounter the above issues.

@wjrogers
Copy link
Contributor

wjrogers commented Feb 7, 2019

@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.

@adstep
Copy link

adstep commented Feb 27, 2019

I'm hitting this issue as well targeting netcoreapp2.1. I have tried a bunch of the beta versions to no avail. Has anyone had any progress?

@stazz
Copy link
Contributor

stazz commented Feb 28, 2019

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.

@arturcic
Copy link
Member

@stazz do you think you could make those changes for GitVersion as a PR?

@stazz
Copy link
Contributor

stazz commented Feb 28, 2019

@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.

@SeppPenner
Copy link

@stazz Do you already have some status update for us? 👍

@stazz
Copy link
Contributor

stazz commented Mar 7, 2019

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?

@arturcic
Copy link
Member

arturcic commented Mar 7, 2019

Hey @stazz, currently we use appveyor and azure pipelines for building/ validating the PRs and commits. The actual build/ test process is done using cake-build and CI is just triggering cake to build the code/ run tests and publish new artifacts. You can also run the same cake build locally and do the tests locally.

In order to do that you can run ./build.ps1 -script build.cake -target Test, or ./build.ps1 -script build.cake -target Build (on windows or linux using powershell core or windows powershell). If you need any other help related to building ping me on gitter.

@arturcic
Copy link
Member

arturcic commented Mar 7, 2019

You can also create a PR and continue pushing commits to the branch you're working on and the CI configured for our repo will build/ validate the code from PR branch

@stazz
Copy link
Contributor

stazz commented Mar 7, 2019

Thank you @arturcic for the answers! Regarding creation of PR and branching: what is the branching model and policies for this repository? Should I just do all the development directly to master, or should I create a dedicated branch for my work?

P.S. I probably won't be able to work very much on this until sunday due to my schedules.

@arturcic
Copy link
Member

arturcic commented Mar 7, 2019

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

@marqueone
Copy link

I am also running into this issue and I'm desperately trying to understand how to resolve this. I've seen in other issues that have been opened about this to use a UTILPACK_NUGET_VERSION environment variable, however I can't seem to find any documentation on how this is used or even configured properly. Any help on this would be awesome.

@stazz
Copy link
Contributor

stazz commented May 9, 2019

The problem was deep in the design of UtilPack task factory which GitVersionTask uses to load itself. The UtilPack task factory is now NuGetUtils task factory, with design which avoids this problem altogether.

There is an ongoing effort to incorporate NuGetUtils task factory in #1634 and #1645 , the latter is probably latest.

@asbjornu
Copy link
Member

Resolved by #1677.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests