❔ Is it possible to change a project sdk from Microsoft.NET.Sdk to Microft.net.sdk.net?
I'm completely new to c# and .NET so apologies if this doesn't make sense.
If a project csproj file has the following
<project sdk="Microsoft.NET.Sdk">
, this means the project is your standard .NET Core project type without any extra features like Web or Blazor right?
But if I wanted to use features from ASP.NET within this project, how would I do it? Do I just change my sdk from Microsoft.NET.Sdk
to Microsoft.NET.Sdk.Net
? Or would I need to run a command like Install-Package
/dotnet add package
?10 Replies
that sdk line is just importing Microsoft.NET.Sdk.props at the top and Microsoft.NET.Sdk.targets at the bottom, which contain some common things including nuget support, some directory properties and hooks up the compiler. to add packages, you add PackageReference nodes
it's either done from vs console, through ui, through dotnet cli, or by just editing the csproj file
So if I just added
to my csproj file, would the Swashbuckle.AspNetCore package just be downloaded(?)/used when I try building the app?
And would something similar would happen if I changed
<project sdk="Microsoft.NET.Sdk">
to <project sdk="Microsoft.NET.Sdk.Web">
?yes
ig web has some more stuff needed for web apps
the properties and launch jsons things I would guess
but fundamentally it just includes the props and the targets files with that name
go off of a template
Interesting. Thanks for the help! It seems like the csproj file is kinda like a package.json file in NodeJS
it's MSBuild
Yeah, except XML because Microsoft loves their
<>
sx'D
ahhh I see
MSBuild is the engine that implements that
dotnet cli is a wrapper for msbuild for the most part
I feel like all this c#/.NET is starting to come together more. Thanks for all the help mate
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.