【问题标题】:.NET Core Publish Compilation Errors.NET Core 发布编译错误
【发布时间】:2020-05-04 11:18:57
【问题描述】:

我有一个 .NET Core 2.2 项目,它在调试和发布配置中都构建得很好。但是,当我尝试发布项目时构建失败。

Startup.cs(26,16): Error CS0246: The type or namespace name 'IConfiguration' could not be found (are you missing a using directive or an assembly reference?) Startup.cs(35,39): Error CS0246: The type or namespace name 'IServiceCollection' could not be found (are you missing a using directive or an assembly reference?) Startup.cs(29,24): Error CS0246: The type or namespace name 'IConfiguration' could not be found (are you missing a using directive or an assembly reference?) Controllers\ConsentController.cs(37,13): Error CS0246: The type or namespace name 'ILogger<>' could not be found (are you missing a using directive or an assembly reference?) Controllers\ConsentController.cs(30,26): Error CS0246: The type or namespace name 'ILogger<>' could not be found (are you missing a using directive or an assembly reference?)

我已尝试清洁溶液。其他人看到过类似的行为吗?

【问题讨论】:

  • 我们需要查看有关您的项目配置的更多详细信息才能回答这个问题。

标签: c# .net-core build publish


【解决方案1】:

从终端试试这个:

dotnet publish

【讨论】:

  • 谢谢!有效,但不知道为什么它在 IDE 中仍然失败。
  • 尝试再次关闭并打开视觉工作室。为我工作。
猜你喜欢
  • 1970-01-01
  • 2021-07-21
  • 1970-01-01
  • 2020-01-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-22
  • 1970-01-01
相关资源
最近更新 更多