I wanted to set up a pipeline but it fails at the NuGet Restore with the following
Errors in packages.config projects
Unable to find version '1.0.0.5' of package 'mypackage'.
https://api.nuget.org/v3/index.json: Package 'mypackage.1.0.0.5' is not found on source 'https://api.nuget.org/v3/index.json'.
##[error]The nuget command failed with exit code(1) and error(Errors in packages.config projects
This package is actually stored on a local NuGet server of my company (internal network) not available from the internet.
Is it possible for Azure DevOps to access these packages?
Yes, it is possible.
You´ll need to have a Self-Hosted Agent ==> e.g. Windows. https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
It makes sense if nuget is stored in a local Nuget repo
Setup Nuget.config to point it to your repo.
4, In the NuGet Restore task be sure to select the Feeds to use --> 'Feeds in my NuGet.config'
==> Example for Private-Repo stuff: https://medium.com/#churi.vibhav/creating-and-using-a-local-nuget-package-repository-9f19475d6af8
Related
I am trying to configure a VB.Net project that has a reference to NuGet package that is stored in our Artifactory repository. I am trying to configure a build in TFS 2018 and I think that there maybe several ways to configure the build in TFS.
I used the .net desktop app template and then modified it. I have it configured as
Use NuGet 4.4.1
NuGet restore
Build Solution
Publish Symbols
Copy Files to ….
Publish Artifact: drop
It’s failing at the NuGet restore:
The nuget command failed with exit code(1) and error(Errors in packages.config projects
Processed: ##vso[task.issue type=error;]The nuget command failed with exit code(1) and error(Errors in packages.config projects%0D%0A Unable to find version '1.0.8' of package 'WPSArchiver-AnyCPU'.%0D%0A C:\Users\TFSBuild1_SVCACCT.nuget\packages: Package 'WPSArchiver-AnyCPU.1.0.8' is not found on source 'C:\Users\TFSBuild1_SVCACCT.nuget\packages\'.%0D%0A https://api.nuget.org/v3/index.json: Package 'WPSArchiver-AnyCPU.1.0.8' is not found on source 'https://api.nuget.org/v3/index.json'.%0D%0A https://xxxxxxxxx.yyyy.com:8443/artifactory/api/nuget/wps-csat-nuget-local: The V2 feed at 'https:// xxxxxxxxx.yyyy.com:8443/artifactory/api/nuget/wps-csat-nuget-local/Packages(Id='WPSArchiver-AnyCPU',Version='1.0.8')' returned an unexpected status code '401 Unauthorized'.)
task result: Failed
Packages failed to restore
So it looks like it does try to access our local instance of Artifactory, but it is getting a '401 Unauthorized'
As you can see in the image above I created a “Credentials for feeds…” For this I created a Nuget authentication
Should I use different build steps? How can I troubleshoot the authentication request. I know that the account that I am using is valid.
It looks like the Feed URL in above service connection for local Artifactory server is not complete. The source URL pointing to Artifactory should be like this http://severname:8081/artifactory/api/nuget/<repository key>.
In your case you can try changing the Feed URL in above screen to https://xxxxxxxxx.yyyy.com:8443/artifactory/api/nuget/wps-csat-nuget-local
The Feed URL should be the same with the packageSources you defined in nuget.config file.
You can modify the setting for Credentials for feeds in the Service connection section of in project settings.
Project settings--> Service connections under Pipelines-->Select your connection(CSAT Artifactory)--> Update the Feed URL.
If it is still not able to authenticate, you can try using the API Key for the Password field of the artifactory connection.
Hope above help!
I'm relatively new to Azure DevOps, but I've already created 4 other pipelines that are working. I'm running into trouble with a build pipeline that is not pulling in NuGet references. I added the Task NuGet restore, but it's only getting some of the packages.
It works when I build in Visual Studio 2017. If I do a nuget restore from the command line, some of the packages are fetched. When I build, Visual Studio fetches the additional packages at the beginning of the build. Why is the NuGet restore task not fetching all of the packages? Why are the remaining packages fetched during the Visual Studio build, but not during the Azure DevOps build?
My project is old legacy ASP.NET that my boss wants automated. I'm talking the version of ASP.NET with .ASPX files that preceded MVC.
This is the error from the Azure DevOps build:
[error]WebApp\web.config(95,0): Error ASPCONFIG: Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
For this issue , first, make sure to select vs2017-win2016 agent when running the pipeline.
Secondly you can try to install the latest nuget.
Another possibility for your issue could be that some packages used by your project is not hosted in nuget.org. If part of the packages used locally are hosted in private server or local package source, the online Nuget Restore Task can't download the mssing packages. Please check your packages.config and project file to make sure all your packages are hosted in nuget.org.
I want to package and publish a .net standard based code as a nuget package using VSTS build. I have created a private nuget feed (in VSTS Artifacts) to which I would like to publish nuget package along with symbols package.
I tried using dotnet CLI tasks to build and publish but it only publish .nupkg and not *.snupkg to the nuget feed.
I googled alot but I only found articles related to publishing to nuget.org and not to a private feed.
Publish *.snupkg symbol package to private feed in VSTS
You can publish the .snupkg symbol package to NuGet.org, or to any NuGet server that opts into this experience. But azure devops private feed does not have this experience.
You can get the detailed info from this wiki NuGet Package Debugging & Symbols Improvements:
When publishing packages, both the symbols package and the .nupkg will be easily published to NuGet.org, or to any NuGet server that opts into this experience.
Reason:
As we know, when we consume .snupkg in Visual Studio, we add a new symbol server location under Symbol file (.pdb) locations:
But Visual Studio can only parse the symbol file (.pdb) directly rather than the .snupkg package, so we need a NuGet server to help us read the .pdb file from the .snupkg package. Azure devops feed is more inclined to be a shared repository of packages.
So, we have to publish *.snupkg symbol package to NuGet.org, or to any NuGet server that opts into this experience.
If you do not want share your package on the nuget.org, You can host your own NuGet server or you can use a lightweight solution to resolve this issue (You can debug the nuget package with private feed).
Hope this helps.
You may well want to just embed the symbol PDB in the main NuGet package itself. IMO that's the best approach here today - it's much simpler, removing the need for the symbol server at all and works well with all repository types, private VSTS/Azure DevOps feeds public repos. The only downside is that clients have to download modestly bigger NuGet packages even if they don't use the debug info, but that seems minor.
Adding the PDB in the NuGet package is normally just a matter of adding this to your project file:
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
See NuGet #4142 and Include pdb files into my nuget (nupkg) files.
Azure Artifacts does not currently support .snupkgs but it does have a symbol server to which you can publish if you're building using Azure Pipelines. This doc walks through setting up a pipeline that publishes symbols.
You can publish the snupkg files to Azure DevOps, but at this point, you cannot consume them from with VS to debug. Here is how I did it:
1) setup a "Use .Net Core" task to upgrade the .net sdk to the version that supports this (as below)
2) setup a custom dotnet pack command (as below)
3) push it to Azure using the dotnet push command (as below)
This results in the snupkg being pushed to Azure DevOps Artifacts, thus:
My I know what should I put in WhatShouldIPutInHere? I want to push my nuget to my team city server. it is on localhost:90. Thanks
[Exec] C:\TeamCity\buildAgent\work\f091ac5edf11aa03\packages\OctoPack.3.5.2\build\OctoPack.targets(109, 5): error MSB3073: The command ""C:\TeamCity\buildAgent\work\f091ac5edf11aa03\packages\OctoPack.3.5.2\build\nuget.exe" push "C:\TeamCity\buildAgent\work\f091ac5edf11aa03\TodoWebApp\obj\octopacked\TodoWebApp.1.0.26.nupkg" MyAPiKey -Source WhatShouldIPutInHere? "
A regular nuget push (what OctoPack is trying to do) is not going to work.
The TeamCity documentation states
You can publish packages to the feed either as build artifacts of the NuGet Pack build step (using the Publish created packages to build artifacts checkbox, packages will be indexed asynchronously) or via the NuGet Publish build step (since TeamCity 2017.1, packages will be indexed synchronously)
Make sure that OctoPack only creates a package (and not trying to push it) and make it an artifact to add it to the TeamCity NuGet Server.
I am using a LinqPad script to automate an internal health check via AppVeyor.
The script references a custom nuget package hosted on our appveyor account.
The build does the following:
Pulls down a GitHub repo
via LPRUN executes health-check.linq
Locally this works.
On AppVeyor it does not.
I have the following build process
SETUP
Via chocolatey --> install Linqpad5
choco install linqpad5
BUILD
nuget install Example.Package
[this is our own NUGET package hosted on AppVeyor [SUCCESS]]
xcopy "c:\projects\example_project\utilities" %AppData%\LINQPad\ /i
[copy our custom NuGetSources.xml file containing our nuget repo location to linqpads folder]
cd "C:\Program Files (x86)\LINQPad5\"
lprun "C:\projects\example_project\utilities\health-check.linq"
ERROR
'Error downloading 'Example.Package' - An error occurred while retrieving package metadata for 'Example.Package' from source 'Example Company Repo'.
Does anyone have any hints on how to reference a custom NUGET repo from a LINQPAD script on APPVEYOR?
More Info
We use AppVeyor for our CI. It allows us to write our own custom NUGET packages for internal use within our own projects.
We have a repository ('FinPad') that contains numerous .linqpad files that automate our processes & house keeping.
Each FinPad script contains a reference to a package called 'FairGo.FinPower' on our own AppVeyor nuget repo. This custom nuget package contains numerous 3rd party .Net DLLs & our own custom code to connect to a 3rd party financial loan management system we use as a backend - http://www.finpower.com.au/ (hosted by us on Azure)
One such script is a 'Health Check' - this confirms a specific environment is operating OK.
For our TEST environment I wanted to schedule our 'health check linqpad' script to run every 15 minutes (and on failure alert stackify & slack)
The process works as follows ( using a custom Azure build machine from AppVeyor)
every 15 minutes
run a custom AppVeyor build called 'Health Check TEST' -->
pull down the GitHub project 'FinPad' to c:\projects\finpad
before build --> choco install linqpad5
Run the below command to copy our own nuget.config (with our own FairGo nuget repo references) to the location linqpad wants for reference
copy "c:\projects\finpad\utilities\nuget.config" "C:\Users\appveyor\AppData\Roaming\NuGet"
*** the above nuget.config contains the url / username /password to our appveyor nuget repo in plain text
build --> cd "C:\Program Files (x86)\LINQPad5\"
after build --> lprun "C:\projects\FinPad\utilities\health-check-test.linq"
For reference the Health check linqpad file is
http://share.linqpad.net/tuthme.linq
Locally this works fine (I manually configured our NUGET repo by the LinqPad GUI locally & assumed it only updated the nuget.config in 'C:\Users\ME\AppData\Roaming\NuGet\nuget.config'. (so I added this file to the repo & copy it every build)
On AppVeyor the build gives the below error
Downloading NuGet package FairGo.FinPower and dependencies from https://api.nuget.org/v3/index.json
Error downloading 'FairGo.FinPower' - Unable to find package 'FairGo.FinPower'.
Command exited with code 1
I have this running through a Console App now - but would really like to get this working through a LinqPad script if possible.