✅ how do i publish my .NET project?

so i made this chess thingy (do check it out, i spent a month on it) and I want to publish it online so i can primarily use it in my other projects. how exactly do i go about this? i'm using vscode btw - vs runs like shit and doesn't correct my code properly. command line would be preferred.
41 Replies
Angius
Angius5mo ago
dotnet publish
slowly losing it
slowly losing itOP5mo ago
where does it get published to? and how can i use it in my own projects?
Angius
Angius5mo ago
It publishes where you want it to And you use it by typing dotnet publish in the terminal and pressing enter
Angius
Angius5mo ago
dotnet publish command - .NET CLI
The dotnet publish command publishes a .NET project or solution to a directory.
slowly losing it
slowly losing itOP5mo ago
bit of a vague answer. are the platforms listed in the docs?
Angius
Angius5mo ago
Everything is listed in the docs
slowly losing it
slowly losing itOP5mo ago
alright thanks angius
Evyr
Evyr5mo ago
Oh I didn't read vscode, sorry
Evyr
Evyr5mo ago
with vscode you publish/build the app with the dotnet publish command, which you can run in the terminal like this
No description
Evyr
Evyr5mo ago
dotnet publish without any arguments will just publish every project or solution in the directory
Evyr
Evyr5mo ago
then for distributing online any file host works, but you could upload a build to the Releases tab of your github repo
No description
slowly losing it
slowly losing itOP5mo ago
what does this mean
No description
slowly losing it
slowly losing itOP5mo ago
ah ok makes sense wait so run dotnet publish then it spits out a compiled exe and associated files?
Angius
Angius5mo ago
Yes
slowly losing it
slowly losing itOP5mo ago
then add that as a release ok got it how would i use it as a package tho?
Angius
Angius5mo ago
Wym as a package? So that someone else can install it as a library in their own project?
slowly losing it
slowly losing itOP5mo ago
like how in your .csproj file you can have <IncludePackage>...<IncludePackage/> yeah more specifically me i wanna try adding a GUI for it
Angius
Angius5mo ago
Ah, well, then you're looking for something else dotnet publish creates the executable For packaging a library you use nuget dotnet pack produces a nuget package
Angius
Angius5mo ago
Angius
Angius5mo ago
Then, you can upload that package to nuget.org, reference it as-is, place it in some folder and set it as one of nuget sources, or upload it to a Github nuget feed Or any other nuget feed, really
slowly losing it
slowly losing itOP5mo ago
whats a nuget feed?
Angius
Angius5mo ago
A registry of nuget packages Where you download nuget packages from
slowly losing it
slowly losing itOP5mo ago
ah ok any links? (i'm new to this so sorry if i'm bugging you over trivial things)
Angius
Angius5mo ago
NuGet documentation
NuGet is the package manager for Microsoft development platforms including .NET. The NuGet client tools provide the ability to create and consume packages.
Angius
Angius5mo ago
This section in particular
No description
slowly losing it
slowly losing itOP5mo ago
alright taking a look does this look good?
<PropertyGroup>
<PackageID>Axololly.Chess.MoveGenerator<PackageID>
<Version>1.0.0</Version>
<PackageTags>Chess;Move Generation;Bitboards</PackageTags>
<Description>
This library features two classes, one for classical chess and another for Chess960, that enable you to play Chess and generate moves in a simple manner.
For more information, check the repository here - https://github.com/axololly/chess/tree/main
</Description>
</PropertyGroup>
<PropertyGroup>
<PackageID>Axololly.Chess.MoveGenerator<PackageID>
<Version>1.0.0</Version>
<PackageTags>Chess;Move Generation;Bitboards</PackageTags>
<Description>
This library features two classes, one for classical chess and another for Chess960, that enable you to play Chess and generate moves in a simple manner.
For more information, check the repository here - https://github.com/axololly/chess/tree/main
</Description>
</PropertyGroup>
Angius
Angius5mo ago
Yeah dotnet pack will tell you if there are any issues, anything missing
slowly losing it
slowly losing itOP5mo ago
it says i have multiple project/solution files i only have 1 (of each)
C:\Users\james.griggs\Desktop\i hate programming pt 2\learning c sharp\chess\chess.csproj(19,5): error MSB4025: The project file could not be loaded. The 'PackageID' start tag on line 11 position 45 does not match the end tag
of 'PropertyGroup'. Line 19, position 5.
C:\Users\james.griggs\Desktop\i hate programming pt 2\learning c sharp\chess\chess.csproj(19,5): error MSB4025: The project file could not be loaded. The 'PackageID' start tag on line 11 position 45 does not match the end tag
of 'PropertyGroup'. Line 19, position 5.
what
Angius
Angius5mo ago
No description
Angius
Angius5mo ago
The tag isn't closed
slowly losing it
slowly losing itOP5mo ago
alright i think its working now oh what you need a Main() entry point? for what?
Angius
Angius5mo ago
No, you don't Not for a package
slowly losing it
slowly losing itOP5mo ago
C:\Users\james.griggs\Desktop\i hate programming pt 2\learning c sharp\chess>dotnet pack chess.csproj
Determining projects to restore...
All projects are up-to-date for restore.
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [C:\Users\james.griggs\Desktop\i hate programming pt 2\learning c sharp\chess\chess.csproj]
C:\Users\james.griggs\Desktop\i hate programming pt 2\learning c sharp\chess>dotnet pack chess.csproj
Determining projects to restore...
All projects are up-to-date for restore.
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [C:\Users\james.griggs\Desktop\i hate programming pt 2\learning c sharp\chess\chess.csproj]
Angius
Angius5mo ago
Ah, well, assuming you didn't change it, the OutputType is set to Exe And an executable needs an entry point Just remove that line
slowly losing it
slowly losing itOP5mo ago
alright, removed it and everything ran smoothly thanks angius i'll let you know it goes tomorrow morning (11:26pm rn)
Angius
Angius5mo ago
:Ok:
TizzyT
TizzyT5mo ago
If this is a lib, id just publish it and upload to nuget.
slowly losing it
slowly losing itOP5mo ago
🦜 hell yeah lets go
slowly losing it
slowly losing itOP5mo ago
Axololly.Chess.MoveGenerator 1.0.0
This library features two classes, one for classical chess and another for Chess960, that enable you to play Chess and generate moves in a simple manner. For more information, check the repository here - https://github.com/axololly/chess/tree/main
slowly losing it
slowly losing itOP5mo ago
@Angius worked fine thanks a ton

Did you find this page helpful?