我有一些c#书中的。nupkg文件。我如何安装它们?
当前回答
最近我想安装松鼠。windows,我尝试安装包松鼠。windows -版本2.0.1从https://www.nuget.org/packages/squirrel.windows/,但它失败了一些错误。所以我下载了squirrel.windows.2.0.1。nupkg并保存在D:\Downloads\,然后我可以通过install - package squirrel成功安装它。windows -verbose -Source D:\Downloads\ -Scope CurrentUser -SkipDependencies
其他回答
Add the files to a folder called LocalPackages next to you solution (it doesn't have to be called that, but adjust the xml in the following step accordingly) Create a file called NuGet.config next to your solution file with the following contents <?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="LocalPackages" value="./LocalPackages" /> </packageSources> <activePackageSource> <!-- this tells that all of them are active --> <add key="All" value="(Aggregate source)" /> </activePackageSource> </configuration> If the solution is open in Visual Studio, close it, then re-open it.
现在您的包应该出现在浏览器中,或者可以使用Install-Package进行安装
菜单工具→选项→包管理器
给出名称和文件夹位置。单击OK。将您的NuGet包文件放在该文件夹中。
转到解决方案资源管理器中的项目,右键单击并选择“管理NuGet包”。选择新的包源。
这里是文档。
您还可以使用包管理器控制台并通过在-Source参数中指定包含包文件的目录的路径来调用安装包cmdlet:
Install-Package SomePackage -Source C:\PathToThePackageDir\
在Linux上,使用NuGet CLI,命令是类似的。安装我的。nupkg,跑
nuget add -Source some/directory my.nupkg
然后在该目录下运行dotnet restore
dotnet restore --source some/directory Project.sln
或者将该目录添加为NuGet源
nuget sources Add -Name MySource -Source some/directory
然后告诉msbuild使用/p:RestoreAdditionalSources=MySource或/p: restoreresources =MySource的目录。第二个开关将禁用所有其他源,例如,这适用于脱机场景。
最近我想安装松鼠。windows,我尝试安装包松鼠。windows -版本2.0.1从https://www.nuget.org/packages/squirrel.windows/,但它失败了一些错误。所以我下载了squirrel.windows.2.0.1。nupkg并保存在D:\Downloads\,然后我可以通过install - package squirrel成功安装它。windows -verbose -Source D:\Downloads\ -Scope CurrentUser -SkipDependencies
推荐文章
- 在Visual Studio中查看多个项目/解决方案
- Visual Studio打开默认浏览器,而不是Internet Explorer
- csproj文件中的“Service Include”是干什么用的?
- 如何在Visual Studio中找到堆栈跟踪?
- 使用不同的Web。在开发和生产环境中进行配置
- 是否有一种方法可以在Visual Studio中删除一行而不剪切它?
- Microsoft Visual Studio的推荐插件
- Visual Studio: ContextSwitchDeadlock
- Visual Studio:如何打破处理异常?
- VS 2017 Git本地提交数据库。每次提交时锁定错误
- 无法启动IIS Express Web服务器,注册URL失败,访问被拒绝
- 如何下载Visual Studio社区版2015(不是2017)
- 查找和替换-添加回车符或换行符
- Visual Studio Community和其他付费版本的区别是什么?
- "输出类型为类库的项目不能直接启动"