I want to download this https://github.com/BobLd/youtube-transcript-api-sharp, but i really can't, it's have a strange README, can anyone help?
I tried commands from README and finding this NugetPackage
UPD: Here's info what to do if u have git rep of library u need but it didn't publish to nuget store, thanks to Bowman Zhu-MSFT
I think you may not have a good understanding of some features in Visual Studio and the concepts related to Nuget packages. Below I will provide a specific step as simple as possible based on the source code you provided.
How to install this NuGet package if I don't see it?
I think what you said can't be seen means that you can't find it in the nuget gallery, right?
The Nuget Gallery is the nuget source of the default configuration of the nuget management of VS Tools (if you just download a VS and start, then this is the source), and it is also the central package repository of the NuGet package manager officially maintained by Microsoft.
But nuget package repository doesn't only have one choice in VS Tools. VS Tools not only supports Microsoft's official package repository, you can use third-party package repository or even local package repository(local folders).
The following contents will tell you how to generate a package based on the source code to local repository and make it visable in VS Tools as usual.
1, Git clone the repository.
git clone https://github.com/BobLd/youtube-transcript-api-sharp.git
If you didn't do this step before or don't have experience on this, you need first download Git via this: Git download. And then find out where is the git command exe, configure it to Path of system environment variables(This step will make you be able to use the git command in any where in your system.).
2, Install the VS Tools(I installed VS2022 community 17.4.4), and prepare .net 5 when install.
The code you provided is based on .net 5:
This is why you need to prepare .net 5.
If you doesn't install before, you can follow below steps to install .net 5:
Search and click in Visual Studio Installer:
Modify the VS Tool you want to update:
3, Prepare the package.
Go to the root directory of the cloned source code repository:
Right click project 'YoutubeTranscriptApi' in Solution Explorer of VS Tool, and click 'Set as Startup Project':
Change the build configuration of 'YoutubeTranscriptApi' to Release:
Right Click project 'YoutubeTranscriptApi' and click Properties:
Select check box 'Produce a package file during build operations' in Package -> General:
Right Your project 'YoutubeTranscriptApi' and click 'Rebuild':
Then the package will be generated with the default package configurations to local path:
You can configure the above local path as the package source in VS Tool:
the path I configured is:
C:\Users\Administrator\Desktop\reproduce\cloned_app\youtube-transcript-api-sharp\YoutubeTranscriptApi\bin\Release
You just need to make sure this path have the package you want.
You can see the package after change package source in Package management:
Finally, I can use the package with no problem:
using System;
using YoutubeTranscriptApi;
namespace UsePackage
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var videoId = "xxx";
using (var youTubeTranscriptApi = new YouTubeTranscriptApi())
{
var transcriptItems = youTubeTranscriptApi.GetTranscript(videoId);
}
}
}
}
Related
In my company, NuGet packages are coming from different sources:
nuget.org (http://api.nuget.org/v3/index.json)
Microsoft Visual Studio Offline Packages (C:\Program files (x86)...\NuGetPackages)
Company_NuGetFeet#local (https://Company.pkgs.visualstudio.com/_packages/.../nuget/v2)
Supervision (some http://10.1.3.xxx/nuget site)
When I start up Visual Studio, I get logged in automatically (at the above right corner, I can see my login settings).
I have access to some NuGet packages and there are some where I don't have access to:
Company.Something.UA : OK
ControlzEx : OK
DevExpress.Chartsv18.2_Core : NOK
I have been doing NuGet restore in lots of ways: normal commandline, developer prompt, using the standard NuGet.exe, using the latest NuGet.exe, from within the company network, from outside the company network, ..., it does not make any difference.
In order to pinpoint the problem, I was thinking of restoring a single NuGet package, which should come from one specific package source, but what is that source?
When checking the properties of NuGet packages (being OK or not), the package source is not mentioned.
So I would like to do:
NuGet.exe restore DevExpress.Chartsv18.2_Core DevExpress..._Core_Package_Source
How can I do that?
How can I know from which package source I need to download a specific NuGet package?
There is no link. Package restore searches all sources in nuget.config (either system-defined or project-defined) for a package, in the order those sources are specified, and installs the first matching package it finds.
What you're really asking is "how do I install a package from a specific source", and you can do that with dotnet restore. Note that NuGet.exe is legacy and deprecated; its package restore functionality is integrated into the dotnet tool and improved there.
> dotnet restore MyPackage -s NugetSourceName
There is no way to know which source a package is available in without browsing it, but as stated above it shouldn't matter; package restore will figure it out.
Now (with .NET 6 tooling) you do have a way to pin packages (patterns) to specific package sources. The feature is called "Package Source Mapping":
https://learn.microsoft.com/en-us/nuget/consume-packages/package-source-mapping
https://www.youtube.com/watch?v=G6P38Dn69Ro
https://devblogs.microsoft.com/nuget/introducing-package-source-mapping/
I have a VS2015 solution with 6 projects in it. I'd like to create a nuget package out of it but:
the project is for internal use only, so I don't want to publish it online
It should include the source code (is it possible?, not a strict requirement)
It should be the final artifact, can I choose a directory where to have such package?
thanks
You can publish nuget in your private host with https://github.com/themotleyfool/Klondike.
you can use nuget Package Explorer to create nuget package. https://github.com/NuGetPackageExplorer/NuGetPackageExplorer
You have multiple options. Either you can use command prompt or Nuget Package Explorer.
In order to publish you can use Nuget official server or private Nuget server. I recommend Nexus Nuget server.
For publish official one, you need to create account and obtain api key.
You can find detailed usage in here.
For including source code, there is no such a thing in official one. Because it aims ready to use artifacts.
You can add your dll, dependencies, extra files such as configs, html etc
What is the best way to make a .dll available as a NuGet package in a local environment so that others can download that and use it whenever they want. We use TFS as the CI server and I want NuGet package (with a version number) to be copied to a location in the intranet after every build so that users can pull it when they want. (Do not want to push). I want this to happen from the all the feature branches, any feature branch other than main needs to package this as a beta. Thanks.
Take a look here: https://www.nuget.org/packages/CreateNewNuGetPackageFromProjectAfterEachBuild/
This will build a nuget package whenever you build.
I am attempting to configure my project / nuget to auto update a specific nuget package. I am currently using NuGet Version 2.8.* and an using the Automatic Package Restore in Visual Studio strategy. My question is what is the best approach to get NuGet to auto update a project before my app builds? Is what I am trying to do even possible using the Automatic Package Restore strategy? Or do I need to use Command-Line Package Restore wrapped in MSBuild, and specify custom update command and target in the NuGet.targets file?
Not currently possible with Visual Studio tooling. NuGet will not automatically upgrade your package version. You must still do this manually.
Not recommended, but in theory, you could write your own script to query nuget.org for the latest version and then upgrade the version number in packages.config. But this seems like a dangerous approach.
This is an old post but in case someone lands here.
One option could be using pre-build script to run below command:
nuget update configPath packageid
Config path could be either project ".cproj" path, solution (.sln) path, or the package.config file path.
https://learn.microsoft.com/en-us/nuget/tools/cli-ref-update
Note that it seems nuget CLI does not work for .NET Core. For Core you need to use dotnet CLI which has integrated nuget command. But that does not have a separate update command (at the time of this post). You need to use add to update but that command needs an explicit version number.
So a workaround could be calling remove and then add commands.
I am writing a Windows Phone app, at the beggining using VS 2010 Express for windows phone. Then I installed VS 2012 and i made a desktop app which consumed JSON/REST service using RestSharp. Due to lack of support for plugins in Express version, i got full VS 2010 Ultimate and installed Nuget. When I create a win phone library project, and i add a RestSharp package, it shows in References, but i cannot access any of it's classes (and using RestSharp is underlined in red color). Also, when i Remove it and add again from Add Reference i get an Incompatible reference error window:
RestSharp.WindowsPhone, Version=103.2.0.0, Culture=neutral, PublicKeyToken=null" is incompatible with
Windows Phone 7.1
In order to add it yourself you should to change the project's terget to a compatible framework first.
It also appears if i change the target to WP 7.0.
Has anyone solved similar problem?
In my case this was because there was a packages.config file in the project folder but not in the solution. This was why I could not add the reference again properly. Delete this file from the physical disk, and re-run your Install-Package command. It should add this correctly now.
Are you using source control?
The it might be possible that you have not yet set the solution to enable package restore (NuGet documentation).
Right click on the Solution node in Solution Explorer and select
Enable NuGet Package Restore.
After that Solution Explorer will contain a few items more and there will be a new folder packages that was automatically added to your solution folder. You will need this folder to add to your version control because it will contain your installed NuGet packages.
That's it.
If you want to know more, here's more details on what it (automatically) does for you:
It added a solution folder named .nuget containing NuGet.exe and a
NuGet.targets MsBuild file. It also changed every project in the
solution to import the NuGet.targets MsBuild task.
With this in place, any time a project is compiled, the build task
will look at each project's packages.config file and for each package
in that file, ensure that the corresponding package exists within the
packages folder. For any missing package, the build task will download
and unpack the package.
In the restore scenario, NuGet will grab the exact version when
restoring a package. It will not perform any upgrades.
Additionally, if you have the latest NuGet version installed, will now find a new option unter Tools -> Options... -> Package Manager -> General -> Allow NuGet to download missing packages during build that I would also suggest to use.
The name says it all. If the solution is configured to use a certain NuGet package but the package is not yet installed on your development machine, NuGet will download it automatically for you when you do your next build.