Preambule:
I would like to setup a NuGet repository hosted inside of my company.
We already had a Nexus OSS 2.13 running so I tried setting up a Nuget hosted repository on it, and uploaded my package there to test it. I then configured NuGet repos on my Visual Studio 2015 in order to add the one on that nexus server.
The problem I encountered then is that VS2015 uses (apparently) nuget feed v3, while Nexus 2.13 has the v2 feed. The symptom was a 404 error while browsing the nexus repository (when nuget calls repo_url/Search()).
The error message looked like :
The v2 feed at '/nexus nuget repository url/Search()?[...]' returned '404 not found'
Browsing it through the repo url in a web browser (without /Search()) works fine, and so is browsing repo_url/FindPackagesById.
I tried downgrading my NuGet vsix version as much as possible, going down to v3.1.1, but no version worked with the v2 feed.
What I tried next:
I looked up Sonatype website about nexus, and saw Nexus v3 is said to handle NuGet, while v2 has no such mention. I decided to try and install Nexus 3 next to our Nexus 2.13 (on the same machine) and see what it had to offer.
I downloaded v3.0.2-02 from that same page as above and started setting it up.
I followed parts of the documentation on how to install it skipping some parts that were already done because of the v2.13 installation. (Disclaimer: I did not install v2.13 myself though I considered installing java runtime environment and stuff like that to be a given).
I then started nexus 3 as a service and successfully reached the home page and logged in as admin.
Having read a statement on hosted repository management in the documentation saying:
By default, the repository manager ships with the following configured hosted repositories:
[...]
nuget-hosted
This hosted repository is where your organization can publish internal
releases in repository using the NuGet repository format. You can also
use this repository for third-party components that are not available in
external repositories, that could potentially be proxied to gain access
to the components.
I headed to Repository -> Repositories section and clicked "Create repository".
Only maven (group/hosted/proxy) and raw (group/hosted/proxy) recipes are available. No Nuget, no npm, nothing else than maven...
Searching a bit, I found in the System -> Bundles section that the bundle for nuget repositories mvn:com.sonatype.nexus.plugins/nexus-repository-nuget/3.0.2-02 is listed as Installed
while maven's mvn:org.sonatype.nexus.plugins/nexus-repository-maven/3.0.2-02 is listed as Active.
I tried looking for a place where bundles can be activated, and thought I found one at $NEXUS_HOME/etc/startup.properties where the first line says:
# Bundles to be started on startup, with startlevel
and contains line looking the one I added to try and activate nuget:
mvn\:com.sonatype.nexus.plugins/nexus-repository-nuget/3.0.2-02 = 10
I then used > sudo service nexus3 restart to restart nexus v3, logged back into admin, went to Repositories, and saw that still no nuget recipe is available.
I went back to Bundles and saw the nuget bundle is still listed as Installed and not Active.
I'm now all out of ideas as to what I could or should do in order to simply create a hosted nuget repository, which should already be available according to nexus' documentation...
What am I missing?
What is wrong with a fresh install missing what the documentation is saying is available by default?
How do I create a hosted NuGet repository on that nexus v3?
I found a way to activate the nexus-repository-nuget plugin:
Activate karaf console in file bin/nexus.vmoptions :
-Dkaraf.startLocalConsole=true
Then start nexus with the run option:
sudo bin/nexus run
And finally in the karaf console, activate nexus-repository-nuget bundle:
bundle:start 214
Now just quit the console and stop the runner, and start as a service. The bundle should be "Activated" and you should be able to create a nuget repository.
Related
Due to the usage of Babel, that require us to host ourself the package manager on a private repository, we are using Azure Devop as a source of our packages.
But now when we look for any package that is not yet somewhere in the solution, we end up with a "No packages found":
Here we were looking for "roslynator"
If I do this same request in a brand new project. No issues at all, I find the packages.
but we have nuget.org correctly specified in the upstream sources:
And the whole team is listed as contributor. I cannot find any error anywhere when we are fetching the packages. I tried to execute the command Install-package Roslynator. The commands succeed, and then I'm able to see the package in the GUI of visual studio(and in the web console of visual studio).
Seems to be an issue on Visual studio level, but I cannot understand what is causing it?
According to the steps in the Consume NuGet packages in Visual Studio document:
If you're using upstream sources, any packages from upstream sources that haven't been saved to your feed yet (by using them at least once) won't appear in the Package Manager search result. To install those packages:
Copy the Install-Package command from the public registry (NuGet.org).
Select Tools then NuGet Package Manager to open the NuGet package
manager.
Paste the command into the Package Manager Console and select run.
So this is the expected behavior and your steps are correct.
Update:
If you want to find all packages in nuget.org, you need to choose nuget.org as source and search packages instead of using your Azure DevOps sources:
According to this document:The nuget.org upstream source allows you to merge the contents of nuget.org into your feed such that the NuGet client can install packages from both locations without making multiple search queries. Enabling upstream sources also automatically enables saving of packages you use from the upstream source.
If you dislike this behavior (and who wouldn't) you can up-vote this Visual Studio Developer Community issue: Allow search upstream sources on Azure Artifacts
And I can confirm as of 12/28/2022 this is still an issue. :-(
I want to set up continuous integration and deployment for an XAP Mobile app in Azure Devops.
In order to get CI/CD I need to set up the Azure Pipeline to install the right packages.
There is some information in the docs on Hosting your own NuGet feeds
and Get started with NuGet packages in Azure DevOps
Dev Express explained that they do not currently provide a Nuget feed for XAF, but I can make my own Delegate's DCNugetPackageBuilder
Using DXNugetPackageBuilder to make Nuget packages
As per the instructions I downloaded the .pdb files extracted them to c:\tmp\symbols
I also downloaded DXNugetPackageBuilder and edited buildPackages.bat according to instructions.
Next I ran build.ps1 in elevated Powershell
This created the .nupkg files at C:\tmp\Nuget
By default this uses the files located at
C:\Program Files (x86)\DevExpress 18.1\Components\Bin\Framework
and the .pdb files located at
c:\tmp\symbols
Using Nuget.Exe and the Credential Provider to push the packages to the feed
The Connect To Feed screen mentions I need to download Nuget.exe and the credential provider
Here are the docs on the Credentials Provider
I unzipped the VSTS CredentialProviders Nuget.Exe is included.
The next step is to follow the instructions given by the "add this feed" section of the Connect To Feed screen.
For example
nuget.exe push -Source "SBDDevExpress" -ApiKey VSTS c:\tmp\Nuget\DevExpress.Data.18.1.6.0.nupkg
I ran into an access denied issue that got solved here
then I was able to push all the packages I wanted.
Set the Nuget Package Source
In VS2017 with my solution open I used Tools -> Nuget Package Manager -> Package Manager Settings
I added package settings with the Azure endpoint set up as a package source.
Errors building
When I run the build pipeline I get errors like
The type or namespace DevExpress could not be found are you missing a directive or assembly reference?
From studying Updater.cs and Module.cs
It seems I am missing the following namespaces from the Nuget feed.
DevExpress.ExpressApp.DC;
DevExpress.ExpressApp.Updating;
DevExpress.Persistent.BaseImpl.PermissionPolicy;
[Update]
DevExpress suggested I compare the dlls generated in the bin folder with my package feed.
I found several missing files and pushed their packages.
I now have
XafMobile.Module\Properties\licenses.licx(1.0): Error LC0003: Unable to resolve type 'DevExpress.ExpressApp.ModuleBase"
I can see from the source code that ModuleBase is a public class in DevExpress.ExpressApp
I am wondering if this is something to do with reflection.
There is some mention of it at Dev Express support
[Update]
I tried removing the licence files and syncing the project.
Now the errors show as missing assembly references
Also When I rebuild my solution the license files are missing from the properties folders
I wonder if this helps explain it
[Update]
Manuel Grunder [DevExpress MVP] and DXNugetPackageBuilder author explained that
"
When working with nuget.packages you need to reference them via nuget as well
as he explains here
"
As is explained here
"When working with nuget.packages you need to reference them via nuget as well. Thats the reason why it did not work in the first place."
I am attempting to restore packages that I've uploaded to my AppVeyor account NuGet feed, yet it is failing to connect to the feed during the build.
In my appveyor.yml file I have:-
nuget:
account_feed: true
And I have confirmed that the account feed mentioned in the logs is the correct URL for my account feed.
I have also opened that feed by connecting to it using Visual Studio and entering my account credentials. When doing that, I have confirmed that the packages I'm trying to restore exist as expected.
However the build fails with this in the logs:-
https://ci.appveyor.com/nuget/xxxxxxxxxx-yyyyyyyyyyyy: Unable to load the service index for source https://ci.appveyor.com/nuget/xxxxxxxxxx-yyyyyyyyyyyy.
The HTTP request to 'GET https://ci.appveyor.com/nuget/xxxxxxxxxx-yyyyyyyyyyyy' has timed out after 100000ms.
NuGet Config files used:
C:\projects\MyProjectName\Source\NuGet.Config
C:\Users\appveyor\AppData\Roaming\NuGet\NuGet.Config
C:\ProgramData\nuget\Config\Microsoft.VisualStudio.Offline.config
C:\ProgramData\nuget\Config\ServiceFabricSDK.config
Feeds used:
C:\Users\appveyor\.nuget\packages\
https://www.nuget.org/api/v2
https://A-CUSTOM-EXTERNAL-NUGET-FEED-I-ALSO-ACCESS/nuget
https://ci.appveyor.com/nuget/xxxxxxxxxx-yyyyyyyyyyyy
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
C:\Program Files\Microsoft SDKs\Service Fabric\packages\
Note: The custom external NuGet feed should be unrelated. I have other packages that successfully restore from there before my build breaks with the private account repo attempt.
Is there something I'm missing that will allow me to connect to my AppVeyor account NuGet repo for the restoring of a package?
Could it have anything to do with the package itself?
AppVeyor has made some changes not allowing you to implicitly include your private account NuGet repository for public code respositories.
As in #ilyaf's answer, the discussion here confirms this, and says the following is the reason.
In previous implementation having this enabled and working for public
project was a vulnerability rather than a feature because on your
account feed you can have NuGet packages from both public and private
projects and anyone submitting PR to public build would have been able
to grab private packages from your account feed. It's fixed now.
So to still get this working, as mentioned in #Feodor Fitsner's comment, you need to configure a new nuget source mentioning your account's NuGet repo.
Here's what you need to do.
Go to the Project in AppVeyor that you're trying to build and select the Settings for that project. On the 'Environments' settings tab, add two new Environment Variables:-
'nuget_user'
'nuget_password'
...placing your AppVeyor credentials in the values for each of those.
In your appveyor.yml, add a new NuGet source under the install node.
install:
- nuget sources add -Name MyAccountFeed -Source <feed-url> -UserName %nuget_user% -Password %nuget_password%
...where <feed-url> is your NuGet feed URL.
Note: These two steps are defined in steps 2 and 3 or this doc.
https://www.appveyor.com/docs/nuget/#configuring-external-private-nuget-feed-for-your-builds
Now, ensure that you have account_feed and project_feed off for your build (otherwise the build will complain that there are duplicate feeds).
Do this by either deleting the following:-
nuget: account_feed:
OR ensure you have
nuget:
account_feed: false
project_feed: false
Your project should now build correctly, retrieving your NuGet packages from your NuGet account.
This, however, may be a workaround to what AppVeyor were trying to initially block with their change.
Please take a look at this discussion.
I've got a build running in VSTS which is restoring NuGet packages from both nuget.org and a custom feed in VSTS. The custom feed is in the solutions NuGet.config as a <packageSource>, along with the user name and password in <packageSourceCredentials>
The build, including the restore, is working Ok, but there is a warning ...
2016-10-12T16:18:57.6589001Z ##[warning]To connect to NuGet feeds
hosted in your Team Services account/TFS project collection with
NuGet 3.1 or below, edit your build definition to specify a path
to a NuGet.config containing the package sources you wish to use.
How can I remove this?
Based on my test, that warning remains even through using higher version of nugget (e.g. 3.3) or do not restore package from VSTS feed. (Hosted build agent has the same result).
You can’t remove it unless you custom a build task to restore package through command line.
I submit a issue here.
Update:
The issue has been updated.
I see the issue in the code coming from our transition from depending
on assets coming with the agent to being deployed with the task. You
can get around this for now until we get an official change out by
either (1) choosing to use the Nuget 3.5 version radio button in the
task config or (2) supplying a path to your nuget.config.
So, you can use Nuget 3.5 version or specify nuget.config file.
I have a Git based Team Project hosted on Team Foundation Service and to avoid checking in packages into the repository, I have enabled NuGet package restore on the solution. I may have missed a fundamental step in having the hosted build controller source these packages (the project is a standard MVC4 Web Api template) as I get this from the failed build log
Unable to find version '2.0.20715.0' of package 'Microsoft.AspNet.Razor'.
Unable to find version '4.0.20710.0' of package 'Microsoft.AspNet.WebApi'.
etc..
It doesn't seem correct to publish these packages to my own nuget feed (myget.org) as they are already available via package manager console, I simple need the TFS hosted controller to fetch them. Does anyone know how I might achieve that?
Thanks!