Dotnet/Devguide

From Gentoo Wiki
Jump to:navigation Jump to:search

.NET guide for Gentoo developers.

Finding correct NuGet packages

To find a list of NuGet packages one can use the dev-dotnet/gentoo-dotnet-maintainer-tools package. First check out via VCS or download sources of a particular project, then cd into its source directory and run:

user $gdmt restore --project "$(pwd)"

Debugging NuGet package sources

Sometimes a package will want to download NuGet packages that are not from the official NuGet Gallery, that is https://api.nuget.org/v3-flatcontainer. The special configuration to control where the NuGet packages are downloaded from lives inside NuGet.config file in the project repository.

To see where the packages are downloaded from restore the project with the following command:

user $NUGET_PACKAGES="$(pwd)/.cache/nuget_packages" dotnet restore --verbosity Detailed

Then, inspect the created restore.log file.

Using v3 sources

Most of the time when the Gallery API v3 version is used the translation of NuGet sources to package URLs is easy. Trailing index.json should be swapped with flat2.

This example:

FILE NuGet.config
<add key="dotnet5" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet5/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />

translates to:

FILE pkg-1.ebuild
NUGET_APIS=(
    "https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet5/nuget/v3/flat2"
    "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/flat2"
)

Maintaining individual packages

Maintaining dotnet-runtime-nugets

The dev-dotnet/dotnet-runtime-nugets package is Gentoo's way of workaround to SDKs requiring a special set of NuGet packages. After you have downloaded or compiled the SDK change to the SDK directory containing the dotnet executable.

Then execute:

user $gdmt checkcore "$(pwd)/dotnet"

Maintaining pwsh

pwsh is the new name of cross-platform version of Powershell developed by Microsoft. Use the tool gdmt genpwsh from gentoo-dotnet-maintainer-tools. As only argument give it the PowerShell version you want to package.

Maintaining fsautocomplete

Prepare the list of NuGet packages with:

user $cd /var/tmp/portage/.../fsautocomplete-.../work/FsAutoComplete-.../
user $export MSBUILDDISABLENODEREUSE=1 RollForward=Major UseSharedCompilation=false
user $export NUGET_PACKAGES="$(pwd)/.cache/nuget_packages"
user $dotnet tool install -g paket
user $paket restore
user $gdmt restore -p ./src/FsAutoComplete/FsAutoComplete.fsproj -e 8.0 -c ./.cache
user $gdmt restore -p ./FsAutoComplete.sln -e 8.0 -c ./.cache

See Also