I have a solution with two host projects (one is a Web Host and the other is a Generic Host) and a class library project referenced by those two host projects.
In the Sdk attribute of the root tag <Project>
of the *.csproj file, both host projects (web host and generic host) are using Microsoft.NET.Sdk.Web
, but the class library project uses the Microsoft.NET.Sdk
.
The two host projects references the Microsoft.AspNetCore.App
metapackage.
The class library project are using Microsoft.NETCore.App
, but it references some ASP.NET Core packages individually (packages of Microsoft.AspNetCore.App
that are not in Microsoft.NETCore.App
).
About the correct SDK and metapackages:
1) In the generic host project, should I use pure .NET Core (Microsoft.NET.Sdk
and Microsoft.NETCore.App
) instead of ASP.NET Core (Microsoft.NET.Sdk.Web
and Microsoft.AspNetCore.App
) since it is not a web project?
2) In the class library project, is it fine to use Microsoft.NET.Sdk
with Microsoft.AspNetCore.App
to avoid the possibility to reference different versions of packages that belong to Microsoft.AspNetCore.App
(to avoid for example, Microsoft.AspNetCore.App@2.1.0
in the host project and Microsoft.Extensions.Configuration@2.0.0
in the class library project)? Or I can only use Microsoft.AspNetCore.App
metapackage with Microsoft.NET.Sdk.Web
SDK?
3) What difference does it make to use Microsoft.NET.Sdk
or Microsoft.NET.Sdk.Web
? The docs says that "The SDK, as the layering document describes, is a set of MSBuild tasks and targets that can build .NET Core code.", but why do we need to have both of them? In practice, what Microsoft.NET.Sdk.Web
does that Microsoft.NET.Sdk
doesn't?