c# - .NET Core 发布编译错误
问题描述
我有一个 .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?)
我试过清洗溶液。其他人看到过类似的行为吗?
解决方案
从终端试试这个:
dotnet publish
推荐阅读
- java - Kafka Streams with processing.guarantee 设置为 EXACTLY_ONCE 问题
- java - build() 方法对 JAX-RS 中的响应有什么作用?
- reactjs - UI State 和 Application State 的边界
- javascript - 在 li 上添加叠加图像
- c - 为什么 Golang 比 ANSI C 更快,我该如何优化我的解决方案?
- c# - 为特定目录可视化 C# 创建一个 getter
- node.js - 你能像使用 nodejs 一样在 nginx 中使用`php artisan serve`吗?
- angular - 如何跳过 *ngFor 中的第一项和最后一项
- javascript - Js函数顶部计算阶乘不起作用
- java - 处理来自多个方法的请求