From e04d4f4f390631ba45f00f9000236113e104152c Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 15 Jan 2020 16:02:40 +0000 Subject: [PATCH] Build as single exe and target win7-x64/x86 Drop nuget package for now --- .github/workflows/build.yml | 8 +++++--- .github/workflows/publish.yml | 35 ----------------------------------- App.xaml.cs | 2 +- README.md | 35 +++++++++++++++-------------------- dotnet-version-check.csproj | 7 +++++++ 5 files changed, 28 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 70bbee0..255bdeb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,9 @@ jobs: with: dotnet-version: 3.1.100 - - name: Build with dotnet - run: dotnet build --configuration Release + - name: Build x64 + run: dotnet publish -c Release -r win7-x64 + + - name: Build x86 + run: dotnet publish -c Release -r win7-x86 - diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 60f6ff7..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: publish - -on: - release: - types: [published] - -jobs: - build: - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v1 - - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.100 - - - name: Build with dotnet - run: dotnet build --configuration Release - - - name: Package - run: dotnet pack --configuration Release - - - name: Setup Publish - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.100 - source-url: https://nuget.pkg.github.com/tjmoore/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - - name: Publish - run: dotnet nuget push bin\Release\*.nupkg diff --git a/App.xaml.cs b/App.xaml.cs index 7d1ebd4..3999016 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -15,7 +15,7 @@ public partial class App : Application private void Application_Startup(object sender, StartupEventArgs e) { - var rootCommand = new RootCommand(description: "Reports .NET runtime version information and triggers a prompt to install .NET Core runtime if applicable") + var rootCommand = new RootCommand(description: "Reports .NET runtime version information and/or triggers a prompt to install .NET Core runtime if applicable") { new Option(new[] { "--no-window" }, "Don't display window, write version information to console"), new Option(new[] { "--silent" }, "Don't display window or write to console. Useful to only trigger .NET Core install if necessary") diff --git a/README.md b/README.md index fadf48c..c667073 100644 --- a/README.md +++ b/README.md @@ -4,30 +4,11 @@ Reports .NET runtime version information and/or triggers a prompt to install .NET Core runtime if applicable - -This relies on .NET Core 3+ built-in support for prompting download and install of .NET Core runtime if not installed when running an executable. This only occurs with Windows GUI Executables. - -The idea is this is a simple executable that can be run during an installer, letting the .NET Core Windows executable bootstrap handle runtime version checking, download and installation. This is useful where the actual .NET Core application being installed is a console or service application which won't generate a prompt and in the case of a service cannot prompt the user without desktop interactivity. - -Additionally, this application can produce a window showing the runtime and target information or send that information to a console. - -An alternative is to go checking install locations and/or registry as described here: - -https://github.com/dotnet/designs/blob/master/accepted/install-locations.md - -However this is somewhat complicated, especially if you want to depend on a compatible install being present, e.g. same version or newer minor & patch version, so that you can pick up latest fixes. This process is built into .NET Core 3 Windows GUI executables anyway so it would seem to make sense to use that functionality. - -Note, this depends on Framework Dependent Executable (FDE) mode of deployment (which is also the default for FDD now in .NET Core 3). It's not relevant to Self Contained Deploment (SCD) as the published application will contain all the dependent runtime and is fixed to the specified target runtime version and platform. - -This primarily is aimed at .NET Core. It might be possible to target .NET Framework and it may report the versions, but even if that works, it likely won't prompt for install. - -The code provided here could act as an example to integrate into other applications, although the actual prompt for install functionality only really requires targetting WinExe output type. - ## Usage ``` dotnet-version-check: - Reports .NET runtime version information and triggers a prompt to install runtime if applicable + Reports .NET runtime version information and/or triggers a prompt to install runtime if applicable Usage: dotnet-version-check [options] @@ -37,3 +18,17 @@ Options: --silent Don't display window or write to console. Useful to only trigger .NET Core install if necessary --version Display version information ``` + +This relies on .NET Core 3+ built-in support for prompting download and install of .NET Core runtime if not installed when running an executable. This only occurs with Windows GUI Executables. + +This idea behind this is primarily for use when installing console or service applications that cannot self-prompt for install of the runtime. The solution here is by creating a WinExe executable targetting .NET Core 3 and running that during install, it should prompt for the missing runtime. This is as an alternative to scripting an installer to detect a compatible runtime globally installed which can be somewhat complex and the framework has built in support for this anyway. + +The executabe need do nothing other than start and shut down, but it does have to be a WinExe target. + +In this example it does a little more by providing a window showing the installed framework and/or reporting to console, but with a 'silent' option for use in an installer so it either does nothing or the user receives a prompt to install the runtime. + +Note, this depends on Framework Dependent Executable (FDE) mode of deployment (which is also the default for FDD now in .NET Core 3). It's not relevant to Self Contained Deploment (SCD) as the published application will contain all the dependent runtime and is fixed to the specified target runtime version and platform. + +This primarily is aimed at .NET Core. It might be possible to target .NET Framework and it may report the versions, but even if that works, it likely won't prompt for install. + + diff --git a/dotnet-version-check.csproj b/dotnet-version-check.csproj index 381d361..98f6e62 100644 --- a/dotnet-version-check.csproj +++ b/dotnet-version-check.csproj @@ -4,6 +4,13 @@ WinExe netcoreapp3.1 + + + win7-x64;win7-x86 + false + true + true + DotNetVersionCheck true DotNetVersionCheck