As part of the build process, it packages with NuGet and pushes to NuGet server. All was OK, but after updating the NuGet version to the latest it just hangs there on the pack command.
I'm using F#Fake for the build process, and after quite a long period the nuget.exe pack command just times out:
Running build failed.
Error:
System.Exception: Process E:\Builds\projectName\build\tools\nuget\nuget.exe pack -Symbols -Version 1.0.0.0-pre -OutputDirectory "E:\Builds\projectName\build\package\out" "E:\Builds\projectName\build\package\tmp\template.nuspec" -NoPackageAnalysis timed out.
at Fake.NuGetHelper.NuGet(FSharpFunc`2 setParams, String nuspecOrProjectFile) in D:\code\FAKE\src\app\FakeLib\NuGet\NugetHelper.fs:line 423
at FSI_0005.Build.clo#163-25.Invoke(Unit _arg10)
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in D:\code\FAKE\src\app\FakeLib\TargetHelper.fs:line 626
Update:
The same command directly without Fake's wrapping, hangs there for around 20 mins on the below lines:
NuGet Version: 4.4.1.4656
Attempting to build package from 'template.nuspec'.
Finally it does create the package, but never used to be that long.
I've tested with NuGet v2.8.6 and same operation takes seconds.
After some trial and error, I've discovered that any of the 4+ versions of a NuGet have the problem with taking ages to create a package.
I've stopped on v3.5.0, where packaging timings are OK.
However it had another unexpected/frustrating change, where it forces the version normalization, i.e. if requested to pack with 1.0.123.0, the nuspec is generated with 1.0.123 skipping the last 0.
Update: apparently the version normalization is a documented breaking change from version 3.4 and above.
Related
In my build pipeline, I have the following step:
I am getting the following error:
##[error]The nuget command failed with exit code(1) and error(NU1102: Unable to find package Microsoft.Windows.SDK.BuildTools with version (>= 10.0.19041.8)
When I go to the NuGet page for this package: Microsoft.Windows.SDK.BuildTools, I see that it only has one version: 10.0.18362.3-preview. I am not sure why the NuGet restore step is trying to get a higher version that does not exist. Why is this happening and how can I fix it? Note: this is my first Pipeline.
Agent Specification: Windows-2019.
From this page, you can see only two versions of the package Microsoft.Windows.SDK.BuildTools are listed:
10.0.19041.1
10.0.18362.3-preview
When open the page of version 10.0.19041.1, you can see the warning message to notify that this package version has been deprecated. But it seems that you can still download and install it.
I think the other package versions may have been permanently deleted by the owner due to some security vulnerabilities. So you no longer find them.
You can try to open your project using Visual Studio on your local machine, and change to use version 10.0.18362.3-preview in your program.
I used CakeBuild to build and test my Xamarin Portable Class Library.
In the build.cake script I defined that I want to use the NUnit-Console to run my testcases. So I do
#tool nuget:?package=NUnit.ConsoleRunner
Unfortunatelly I get the following error when I run the Cake script.
Preparing to run build script...
VERBOSE: Restoring tools from NuGet...
VERBOSE: Feeds used:
C:\Users\bergkar\.nuget\packages\
All packages listed in C:\dev\Xamarin\fleetboard-core-library\tools\packages.config are already installed.
Running build script...
Analyzing build script...
Processing build script...
Installing tools...
Unable to find package 'NUnit.ConsoleRunner'
NuGet exited with 1
Could not find any relevant files for tool 'NUnit.ConsoleRunner'. Perhaps you need an include parameter?
Error: Failed to install tool 'NUnit.ConsoleRunner'.
When I add a specific version I want to use like below then everything works fine.
#tool nuget:?package=NUnit.ConsoleRunner&version=3.7.0
Can someone tell me why it is not working without the version stuff?
With ".\build.ps1 -Verbosity Diagnostic" I get the following output:
Preparing to run build script...
Running build script...
Module directory does not exist.
Analyzing build script...
Analyzing C:/dev/Xamarin/fleetboard-core-library/build.cake...
Processing build script...
Installing tools...
Installing NuGet package NUnit.ConsoleRunner...
Executing: "C:/dev/Xamarin/fleetboard-core-library/tools/nuget.exe" install "NUnit.ConsoleRunner" -OutputDirectory "C:/d
ev/Xamarin/fleetboard-core-library/tools" -ExcludeVersion -NonInteractive
Unable to find package 'NUnit.ConsoleRunner'
NuGet exited with 1
Feeds used:
Output:
Feeds used:
Could not find any relevant files for tool 'NUnit.ConsoleRunner'. Perhaps you need an include parameter?
Error: Cake.Core.CakeException: Failed to install tool 'NUnit.ConsoleRunner'.
at Cake.Core.Scripting.ScriptProcessor.InstallTools(ScriptAnalyzerResult analyzerResult, DirectoryPath installPath)
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
at Cake.Commands.BuildCommand.Execute(CakeOptions options)
at Cake.CakeApplication.Run(CakeOptions options)
at Cake.Program.Main()
Now I found my problem and solved it.
The problem was that the NuGet.exe did not has a source feed which points to a public nuget source like "https://api.nuget.org/v3/index.json".
This was because my default NuGet.conf in under "C:\Users\YOUR_USER_HOME\AppData\Roaming\NuGet" had no packageSource defined. So Nuget just knows the local nuget package cache under "C:\Users\YOUR_USER_HOME.nuget\packages" and this did not include the specified package.
So after I added a packageSource in "C:\Users\YOUR_USER_HOME\AppData\Roaming\NuGet\NuGet.Conf" everything works fine.
Another way can be to add a new NuGet.Conf beside your build.ps1 file which contains all package sources you need for CakeBuild and your Xamarin project.
The following page explains how Nuget finds its configuration. Maybe this is helpful to understand the mechanism NuGet uses to find its configuration:
https://learn.microsoft.com/en-us/nuget/consume-packages/configuring-nuget-behavior
I've got a VSTS build, starting from a blank, originally with just Node.js bits, but now adding some C# bits.
Added the NuGet restore, build sln and vstest tasks as part of the update to the build.
Build fails on the NuGet restore task with the error around the MSTest TestAdapter ...
Restoring NuGet package MSTest.TestAdapter.1.1.11.
Restoring NuGet package MSTest.TestFramework.1.1.11.
WARNING: Unable to find version '1.1.11' of package 'MSTest.TestFramework'.
WARNING: Unable to find version '1.1.11' of package 'MSTest.TestAdapter'.
Errors in packages.config projects
Unable to find version '1.1.11' of package 'MSTest.TestFramework'.
Unable to find version '1.1.11' of package 'MSTest.TestAdapter'.
Why doesn't it pick up the MSTest package?
And even more puzzling to me ??? ...
I spotted the task was version 2.*
tried setting it to version 0.* ...
and the build works !! ... runs tests, etc.
Why does version 0.* work, yet the latest version 2.* fails?
I have latest versions of MonoDevelop(5.10) and NUnit(3.6.1 installed from oficiall NuGet Gallery) and every time I'm trying to run tests I'm getting error
UnsupportedFrameworkException: Skipped loading assembly ... because it references an unsupported version of the nunit.framework 3.6.1.0
What can I do about it ?
You are apparently trying to run the tests from inside of MonoDevelop, which only supports NUnit through 2.4.8.
You need to install and run the nunit console runner. Use the NUnit.ConsoleRunner nuget package and run nunit3-console, which is contained in the package.
I have a Build definition in Team Services that includes a Nuget Packager task. I'm using Hosted build agents.In the last couple of builds this task began to fail, with the following message:
2017-02-22T21:43:24.9318762Z C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\2.112.0\externals\nuget\NuGet.exe pack "D:\a\1\s\src\app\Ormie\Ormie.csproj" -OutputDirectory "D:\a\1\s" -Properties Configuration=release
2017-02-22T21:43:25.5460318Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
2017-02-22T21:43:25.5460318Z Attempting to build package from 'Ormie.csproj'.
2017-02-22T21:43:25.7480272Z Packing files from 'D:\a\1\s\src\app\Ormie\bin\Release'.
2017-02-22T21:43:25.9040273Z Using 'Ormie.nuspec' for metadata.
2017-02-22T21:43:26.1645370Z ##[error]'System.Collections' already has a dependency defined for 'Microsoft.NETCore.Platforms'.
2017-02-22T21:43:26.1865365Z ##[error]System.Exception: Unexpected exit code 1 returned from tool NuGet.exe
2017-02-22T21:43:26.1865365Z at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeToolCmdlet.ProcessRecord()
2017-02-22T21:43:26.1865365Z at System.Management.Automation.CommandProcessor.ProcessRecord()
2017-02-22T21:43:26.2015355Z ##[error]PowerShell script completed with 1 errors.
2017-02-22T21:43:26.2025352Z ##[section]Finishing: NuGet Packager
In order to understand what was happening, I tried to create the package in my development box, using NuGet version 3.3, and got a similar message. So, I've updated NuGet to version 3.5, tried to pack in my machine and it worked just fine.So, my questions are:
Is there any kind of configuration in Team Services Build Definition
that can be done to solve this issue?
How can I force the Hosted build agent to use version 3.5 in the
NuGet Packager task?
To use nuget3.5 for nugget packager task, you can add nugget.exe to source control, and then use $(Build.SourcesDirectory)\nuget.exe as path to nugget.exe.
For Nuget Restore and Nuget Publisher Tasks, they define 3.3 and 3.5 in their tasks. You can view task.json for all tasks definitions in VSTS task.
If you want Nuget Packager also can choose nugget version, you should develop your own task same as Nuget Packager function and with nuget version to choose.