.NET Core 发布编译错误 [英] .NET Core Publish Compilation Errors
问题描述
我有一个 .NET Core 2.2 项目,它在 Debug 和 Release 配置中构建都很好.但是,当我尝试发布项目时,构建失败.
I have a .NET Core 2.2 project that builds in both Debug and Release configuration just fine. However, the build fails when I try and publish the project.
Startup.cs(26,16):错误 CS0246:找不到类型或命名空间名称IConfiguration"(您是否缺少 using 指令或程序集引用?)Startup.cs(35,39):错误 CS0246:找不到类型或命名空间名称IServiceCollection"(您是否缺少 using 指令或程序集引用?)Startup.cs(29,24):错误 CS0246:找不到类型或命名空间名称IConfiguration"(您是否缺少 using 指令或程序集引用?)ControllersConsentController.cs(37,13):错误 CS0246:类型或命名空间名称ILogger<>"找不到(您是否缺少 using 指令或程序集引用?)ControllersConsentController.cs(30,26):错误 CS0246:类型或命名空间名称ILogger<>"找不到(您是否缺少 using 指令或程序集引用?)
我试过清洗溶液.还有其他人看到过类似的行为吗?
I've tried cleaning the solution. Anyone else seen similar behaviour?
推荐答案
从终端试试这个:
dotnet publish
这篇关于.NET Core 发布编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!