build-dotnet-module: add useAppHost parameter so it can be disabled

This commit is contained in:
David McFarland 2022-09-24 08:07:57 -03:00
parent 62ecb39a1f
commit 4c861dd26c
3 changed files with 12 additions and 1 deletions

View file

@ -71,6 +71,8 @@
, buildType ? "Release" , buildType ? "Release"
# If set to true, builds the application as a self-contained - removing the runtime dependency on dotnet # If set to true, builds the application as a self-contained - removing the runtime dependency on dotnet
, selfContainedBuild ? false , selfContainedBuild ? false
# Whether to explicitly enable UseAppHost when building
, useAppHost ? true
# The dotnet SDK to use. # The dotnet SDK to use.
, dotnet-sdk ? dotnetCorePackages.sdk_6_0 , dotnet-sdk ? dotnetCorePackages.sdk_6_0
# The dotnet runtime to use. # The dotnet runtime to use.
@ -147,6 +149,8 @@ stdenvNoCC.mkDerivation (args // {
# gappsWrapperArgs gets included when wrapping for dotnet, as to avoid double wrapping # gappsWrapperArgs gets included when wrapping for dotnet, as to avoid double wrapping
dontWrapGApps = args.dontWrapGApps or true; dontWrapGApps = args.dontWrapGApps or true;
inherit selfContainedBuild useAppHost;
passthru = { passthru = {
inherit nuget-source; inherit nuget-source;

View file

@ -20,6 +20,10 @@ dotnetBuildHook() {
dotnetBuildFlags+=("-p:SelfContained=false") dotnetBuildFlags+=("-p:SelfContained=false")
fi fi
if [ "${useAppHost-}" ]; then
dotnetBuildFlags+=("-p:UseAppHost=true")
fi
if [ "${version-}" ]; then if [ "${version-}" ]; then
local -r versionFlag="-p:Version=${version-}" local -r versionFlag="-p:Version=${version-}"
fi fi
@ -31,7 +35,6 @@ dotnetBuildHook() {
-p:BuildInParallel=$parallelBuildFlag \ -p:BuildInParallel=$parallelBuildFlag \
-p:ContinuousIntegrationBuild=true \ -p:ContinuousIntegrationBuild=true \
-p:Deterministic=true \ -p:Deterministic=true \
-p:UseAppHost=true \
--configuration "@buildType@" \ --configuration "@buildType@" \
--no-restore \ --no-restore \
${versionFlag-} \ ${versionFlag-} \

View file

@ -12,6 +12,10 @@ dotnetInstallHook() {
dotnetInstallFlags+=("--no-self-contained") dotnetInstallFlags+=("--no-self-contained")
fi fi
if [ "${useAppHost-}" ]; then
dotnetInstallFlags+=("-p:UseAppHost=true")
fi
dotnetPublish() { dotnetPublish() {
local -r project="${1-}" local -r project="${1-}"
env dotnet publish ${project-} \ env dotnet publish ${project-} \