✅ 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
Angius2mo ago
dotnet publish
it’s raining outside
where does it get published to? and how can i use it in my own projects?
Angius
Angius2mo ago
It publishes where you want it to And you use it by typing dotnet publish in the terminal and pressing enter
Angius
Angius2mo ago
dotnet publish command - .NET CLI
The dotnet publish command publishes a .NET project or solution to a directory.
it’s raining outside
bit of a vague answer. are the platforms listed in the docs?
Angius
Angius2mo ago
Everything is listed in the docs
it’s raining outside
alright thanks angius
Evyr
Evyr2mo ago
Oh I didn't read vscode, sorry
Evyr
Evyr2mo 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
Evyr2mo ago
dotnet publish without any arguments will just publish every project or solution in the directory
Evyr
Evyr2mo 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
it’s raining outside
what does this mean
No description
it’s raining outside
ah ok makes sense wait so run dotnet publish then it spits out a compiled exe and associated files?
Angius
Angius2mo ago
Yes
it’s raining outside
then add that as a release ok got it how would i use it as a package tho?
Angius
Angius2mo ago
Wym as a package? So that someone else can install it as a library in their own project?
it’s raining outside
like how in your .csproj file you can have <IncludePackage>...<IncludePackage/> yeah more specifically me i wanna try adding a GUI for it
Angius
Angius2mo 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
Angius2mo ago
Angius
Angius2mo 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
it’s raining outside
whats a nuget feed?
Angius
Angius2mo ago
A registry of nuget packages Where you download nuget packages from
it’s raining outside
ah ok any links? (i'm new to this so sorry if i'm bugging you over trivial things)
Angius
Angius2mo 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
Angius2mo ago
This section in particular
No description
it’s raining outside
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
Angius2mo ago
Yeah dotnet pack will tell you if there are any issues, anything missing
it’s raining outside
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
Angius2mo ago
No description
Angius
Angius2mo ago
The tag isn't closed
it’s raining outside
alright i think its working now oh what you need a Main() entry point? for what?
Angius
Angius2mo ago
No, you don't Not for a package
it’s raining outside
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
Angius2mo 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
it’s raining outside
alright, removed it and everything ran smoothly thanks angius i'll let you know it goes tomorrow morning (11:26pm rn)
Angius
Angius2mo ago
:Ok:
TizzyT
TizzyT2mo ago
If this is a lib, id just publish it and upload to nuget.
it’s raining outside
🦜 hell yeah lets go
it’s raining outside
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
it’s raining outside
@Angius worked fine thanks a ton
Want results from more Discord servers?
Add your server