NuGet 包安装失败 [英] NuGet package fails to install

查看:84
本文介绍了NuGet 包安装失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些内部可重用的库,我们目前正在我的工作场所处理这些库.我认为将其中一些放在内部 NuGet 服务器上会很好.不幸的是,事实证明这比计划的要困难.

We've got some internal reusable libraries that we're currently juggling around at my place of work. I thought it would be nice to chuck some of these on an internal NuGet server. Unfortunately this is proving harder than planned.

我正在试用的包是一个简单的 JavaScript 库.我创建了一个名为 Package 的文件夹,其中包含一个名为 Scripts 的文件夹,我将 JS 文件放入其中.然后我在 Package 文件夹中打开一个命令提示符并运行 NuGet spec ,它运行成功.然后我编辑了 .nuspec 文件并运行 NuGet pack,生成一个 .nupkg 文件.

The package I'm trialing this with is a simple JavaScript library. I created a folder called Package containing a folder called Scripts, which I put the JS files in. I then opened a command prompt at the Package folder and ran NuGet spec which ran successfully. Then I edited the .nuspec file and ran NuGet pack, generating a .nupkg file.

太好了,完美运行.我添加了包含 .nupkg 文件的文件夹作为 NuGet 源.我现在可以运行(从命令行)NuGet 安装并且运行良好!

Great, works perfectly. I added the folder containing the .nupkg file as a NuGet source. I can now run (from the commandline) NuGet install and it works fine!

我已经设置了一个测试项目并准备好使用这个库,剩下的唯一事情就是安装包.所以在 Visual Studio 中,我进入 Manage NuGet Packages 并选择我的源.我选择我的库并点击安装,然后弹出一个显示进度的对话框.它说成功安装",然后退出.但是,在 Manage NuGet Packages 中,安装按钮未更改为卸载按钮,该包未显示在已安装的包下,并且该包中的任何文件均未添加到我的项目或存在于磁盘上.以后点击安装按钮完全没有作用.

I have a test project all set up and ready to go for this library, the only thing left is to install the package. So in Visual Studio I go into Manage NuGet Packages and select my source. I select my library and hit install and a dialog pops up showing progress. It says "successfully installed" and all that and then exits. However in Manage NuGet Packages the install button HAS NOT changed to an uninstall button, the package does not show up under Installed Packages and none of the files from the package have been added to my project or exist on the disk. Clicking on the install button subsequent times does absolutely nothing.

不太确定我做错了什么,非常感谢您的帮助.

Not really sure what I'm doing wrong, would very much appreciate some help.

谢谢,

YM

我应该提到我可以很好地安装其他软件包,并且我尝试在不同的解决方案中安装这个软件包,结果相同.

I should mention that I can install other packages just fine, and I have tried installing this package in a different solution with the same result.

推荐答案

好的,问题是 Scripts 文件夹不应直接位于包的根目录中,而必须位于 Content 文件夹下.我花了很长时间才弄明白,希望它可以帮助其他人.

Okay, the issue was that the Scripts folder should not go directly in the root directory of the package, but instead must sit under a Content folder. That took me a long time to work out, hopefully it helps someone else.

这篇关于NuGet 包安装失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆