我正在运行一个简单的 .NET 应用程序,该应用程序连接到 Azure 事件中心并发送示例数据。 不幸的是,当我点击“dotnet run”时,我收到以下错误:
C:\Users\[...]\EventHubSampleSendData\Program.cs(1,7): error CS0246: The type or namespace name 'Azure' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\[...]\SendSampleData.csproj]
看起来 dotnet 无法识别 Program.cs 内的 Azure 库“(使用)Azure.Messaging.EventHubs”
我尝试了命令“dotnet add package Azure.Messaging.EventHubs”,但它也给出了错误(该项目不支持通过添加包命令添加包引用。)
最佳答案
解决方案是重新安装或恢复您在创建项目时安装的所有软件包。实现方法是:
关于c# - 如何解决 Dotnet 构建错误 "namespace name ' Azure' 找不到”?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73311295/