- If building using managed IDEs like Rider or Visual Studio, ensure that a valid
--runtime ...argument is being passed todotnet, orRuntimeIdentifier=...is set for callingmsbuild. This is required for runtime-specific resources to be included in the build. Stability Matrix currently supports building for thewin-x64,linux-x64andosx-arm64runtimes. - You can also build the
StabilityMatrix.Avaloniaproject usingdotnet:
dotnet build ./StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj -r win-x64 -c Debug- Note that on Windows, the
net8.0-windows10.0.17763.0framework is used, build outputs will be inStabilityMatrix.Avalonia/bin/Debug/net8.0-windows10.0.17763.0/win-x64. On other platforms thenet8.0framework is used.
(Replace $RELEASE_VERSION with a non v-prefixed semver version number, e.g. 2.10.0, 2.11.0-dev.1, etc.)
dotnet publish ./StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj -r win-x64 -c Release -p:Version=$env:RELEASE_VERSION -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=trueThe output_dir environment variable can be specified or defaults to ./out/osx-arm64/
./Build/build_macos_app.sh -v $RELEASE_VERSIONsudo apt-get -y install libfuse2
dotnet tool install -g KuiperZone.PupNet
pupnet -r linux-x64 -c Release --kind appimage --app-version $RELEASE_VERSION --clean- Building the
StabilityMatrix.Avaloniaproject once should also install Husky.Net, or run the following command:
dotnet tool restore && dotnet husky installdotnet husky install- Refitter is used to generate some OpenApi clients. New clients should be added to
./.husky/task-runner.json. - To regenerate clients, run the following command:
dotnet husky run -g generate-openapiThese are just guidelines, mostly following the official C# style guidelines, except in a few cases. We might not adhere to these 100% ourselves, but lets try our best :)
- Use pascal casing ("PascalCasing") when naming a
class,record,struct, orpublicmembers of types, such as fields, properties, methods, and local functions. - When naming an
interface, use pascal casing in addition to prefixing the name with the letterIto clearly indicate to consumers that it's aninterface.
- Use camel casing ("camelCasing") when naming
privateorinternalfields. - Do not prefix them with an underscore
_
- Please do not check in code with unused using statements.
- Always use file-scoped namespaces. For example:
using System;
namespace X.Y.Z;
class Foo
{
}- Use implicit typing (
var) for local variables when the type of the variable is obvious from the right side of the assignment, or when the precise type is not important.
- Only omit curly braces from
ifstatements if the statement immediately following is areturn.
For example, the following snippet is acceptable:
if (alreadyAteBreakfast)
return;Otherwise, it must be wrapped in curly braces, like so:
if (alreadyAteLunch)
{
mealsEaten++;
}- Try to follow our existing structure, such as putting model classes in the
Models\directory, ViewModels inViewModels\, etc. - Static classes with only extension methods should be in
Extensions\ - Mock data for XAML Designer should go in
DesignData\ - The
Helper\andServices\folder don't really have guidelines, use your best judgment - XAML & JSON converters should go in the
Converters\andConverters\Json\directories respectively - Refit interfaces should go in the
Api\folder