VB.NET Azure部署没有/bin但有nuget包

标签 vb.net azure nuget

我刚刚发布(通过 GitHub)一个 VB.NET Azure 网站,该网站在本地计算机上运行良好,但在 Azure 上运行不佳:

Compiler Error Message: BC30451: 'Newtonsoft' is not declared. It may be inaccessible due to its protection level.

Dim category As Category = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Category)(json)

Newtonsoft.Json 包通过 NuGet 安装:Newtonsoft.Json.5.0.5。 它是目前项目中唯一的第 3 方 dll。

我使用 Azure ftp 访问浏览到 /site/wwwroot/ 并注意到没有 /bin 目录。

现在,我的 .gitignore 排除了 [Bb]in 和 [Oo]bj 文件夹,但它与我在 C# 项目中成功使用的 .gitignore 相同,并且始终假设 Azure 只是从 /获取丢失的 nuget dll包

这是我的第一个 VB.NET > GitHub > Azure 网站部署。我错过了什么?

编辑:我可以确认,如果我通过 Azure ftp 上传 /Bin/Newtonsoft.Json.dll,则该网站可以正常工作。或者至少在重新成像之前它会......

最佳答案

听起来您尚未启用“NuGet Package Restore”。

这样做会在解决方案的根目录创建一个 .nuget 文件夹,并在应用程序中创建一个 packages.config 文件,Azure 中的构建过程将拾取该文件并从中加载所需的引用资料。

右键单击解决方案,它应该是其中的一个选项。

关于VB.NET Azure部署没有/bin但有nuget包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16923172/

相关文章:

vb.net - 根据光标所在位置将文本添加到文本框

.net - 如何在 ASP.NET 中为 Craigslist 批量发布创建根 RDF/XML 元素

azure - AKS 群集托管标识中的 Nginx 服务无权读取 publicIPAddresses

azure - 如何在 Azure 免费服务中免费创建虚拟机

c# - 如何在 .NET Core 中以编程方式下载最新的 nuget 包?

.net - 消除 System.Array 中的间隙

node.js - 错误 [ERR_HTTP_HEADERS_SENT] : Cannot set headers after they are sent to the client Registering user in node JS

c# - 通过 Azure Devops 部署 Nuget 包时未添加依赖项

C# sqlite 无法加载sqlite3.dll

vb.net 填充多列 ListView