Reputation: 20748
I am having a weird situation where I cannot publish my final Web project. Here is the project structure:
Foo.Services.Common
: this is shared library: .NET Standard 2.0.3
, Microsoft.AspNetCore.Mvc.Core 2.1.0
with the class DefaultWebSettings
defined.
Foo.Services.Common.Razor
: Razor Class Library, has reference back to Foo.Services.Common
and uses DefaultWebSettings
: NETStandard.Library 2.0.3
, Microsoft.AspNetCore.Mvc 2.1.0
and some other ASP.NET Core related package (static files, Configuration)
Foo.Services.Api
: ASP.NET Core API only (no View, no Razor), has reference back to Foo.Services.Common
. Publish well. Uses: Microsoft.AspNetCore.App 2.1.0
, Microsoft.NETCore.App 2.1.0
.
Foo.Services.Web
: front end project. This one is the one I cannot publish! This one has references to both Common
projects. Uses: Microsoft.AspNetCore.App 2.1.0
, Microsoft.NETCore.App 2.1.0
However, upon publish, this one shows up:
The type or namespace name 'DefaultWebSettings' could not be found (are you missing a using directive or an assembly reference?)
The error location is in a file of Foo.Services.Common.Razor
project, NOT the Web
project.
Funnily, Visual Studio perfectly works even with IntelliSense and Go to Definition:
I can build in both Debug/Release mode, run with/without debug any project in the solution well. Moreover, publishing Foo.Services.Common.Razor
works without any problem!
In short: I cannot publish my Web
project and have no idea what is the problem. I have tried:
Please show me what I may missing.
Upvotes: 0
Views: 603
Reputation: 20748
In the end, I had to remove Reference of the Common
from Common.Razor
and Web
projects. I guess they could not build because of some conflict between .NET Standard and .NET Core. Had to copy all code of Common
into Common.Razor
.
Upvotes: 0