Skip to content

Commit

Permalink
Upgrade to .NET 8 (#965)
Browse files Browse the repository at this point in the history
This PR (finally) upgrades from the now unsupported .NET 7 to .NET 8. The installer now automatically includes the .NET runtime, so you don't have to install it separately. The .NET SDK is not included, so you will need to install it separately if you use it during scripting.
  • Loading branch information
dalyIsaac authored Aug 4, 2024
1 parent ac6e2e8 commit a286e32
Show file tree
Hide file tree
Showing 36 changed files with 178 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ publish/
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
# *.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Whim.Runner/bin/x64/Debug/net7.0-windows10.0.19041.0/Whim.Runner.exe",
"program": "${workspaceFolder}/src/Whim.Runner/bin/x64/Debug/net8.0-windows10.0.19041.0/Whim.Runner.exe",
"args": [],
"cwd": "${workspaceFolder}/src/Whim.Runner",
"console": "internalConsole",
Expand Down
20 changes: 10 additions & 10 deletions docs/docs/contribute/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ Tests have not been written for all of Whim's code, but are encouraged. Tests ha
To use your existing configuration, make sure to update the `#r` directives to point to your newly compiled DLLs. For example, replace `C:\Users\<USERNAME>\AppData\Local\Programs\Whim` with `C:\path\to\repo\Whim`:

```csharp
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\whim.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.Bar\Whim.Bar.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.CommandPalette\Whim.CommandPalette.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.FloatingWindow\Whim.FloatingWindow.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.FocusIndicator\Whim.FocusIndicator.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.Gaps\Whim.Gaps.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.LayoutPreview\Whim.LayoutPreview.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.TreeLayout\Whim.TreeLayout.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.TreeLayout.Bar\Whim.TreeLayout.Bar.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net7.0-windows10.0.19041.0\plugins\Whim.TreeLayout.CommandPalette\Whim.TreeLayout.CommandPalette.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\whim.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\plugins\Whim.Bar\Whim.Bar.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\plugins\Whim.CommandPalette\Whim.CommandPalette.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\plugins\Whim.FloatingWindow\Whim.FloatingWindow.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\plugins\Whim.FocusIndicator\Whim.FocusIndicator.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\plugins\Whim.Gaps\Whim.Gaps.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\plugins\Whim.LayoutPreview\Whim.LayoutPreview.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\plugins\Whim.TreeLayout\Whim.TreeLayout.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\plugins\Whim.TreeLayout.Bar\Whim.TreeLayout.Bar.dll"
#r "C:\Users\dalyisaac\Repos\Whim\src\Whim.Runner\bin\x64\Debug\net8.0-windows10.0.19041.0\plugins\Whim.TreeLayout.CommandPalette\Whim.TreeLayout.CommandPalette.dll"

// Old references:
// #r "C:\Users\dalyisaac\AppData\Local\Programs\Whim\whim.dll"
Expand Down
17 changes: 14 additions & 3 deletions docs/docs/getting-started/customize.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Customizing Whim

## Scripting

When you run Whim for the first time, it will create the `C:\Users\{username}\.whim` directory populated with a [C# script](https://github.com/dalyIsaac/Whim/blob/main/src/Whim/Template/whim.config.csx) and resources.

`whim.config.csx` is a C# script file, and is reloaded every time Whim starts. On first run, it is populated with a pre-filled example which you can use as a starting point - see the config [here](https://github.com/dalyIsaac/Whim/blob/main/src/Whim/Template/whim.config.csx).

The core of the configuration is nested inside a <xref:Whim.DoConfig> function, which is written in typical C# code. The function takes an <xref:Whim.IContext> parameter. `DoConfig` is the entry point for your config. Prior to calling `DoConfig`, Whim will set up the `IContext` and its constituent parts, which exposes Whim's [API](/api) to be used in the configuration. For more, see the [Scripting](../customize/scripting.md) page.
The core of the configuration is nested inside a <xref:Whim.DoConfig> function, which is written in typical C# code. The function takes an <xref:Whim.IContext> parameter. `DoConfig` is the entry point for your config. Prior to calling `DoConfig`, Whim will set up the `IContext` and its constituent parts, which exposes Whim's [API](/api) to be used in the configuration.
**For more, see the [Scripting](../customize/scripting.md) page**.

The pages under the **Customize** section (in the left sidebar) document popular configuration options. Unless explicitly stated otherwise, all code snippets found in the **Customize** section are expected to be located inside the body of `DoConfig`.

## Recommended tooling

Whim will install a self-contained .NET 8 instance as part of the installation process. To have the best experience while configuring Whim, it's recommended to install the following tools:

The "Customize" section documents popular configuration options. Unless explicitly stated otherwise, all code snippets found in the "Customize" section are expected to be located inside the body of `DoConfig`.
- [Visual Studio Code](https://code.visualstudio.com/download)
- [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) extension for Visual Studio Code
- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) for Windows

To have the best development experience, you should have .NET tooling installed (Visual Studio Code will prompt you when you open `.whim`).
## Script location

To customize the location of the `.whim` directory, set the `--dir` CLI argument when starting Whim.
2 changes: 1 addition & 1 deletion omnisharp.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"script": {
"enabled": true,
"defaultTargetFramework": "net7.0-windows10.0.19041.0",
"defaultTargetFramework": "net8.0-windows10.0.19041.0",
"enableScriptNuGetReferences": true
}
}
5 changes: 3 additions & 2 deletions scripts/Create-Installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ param (
[string]$Architecture
)

$buildDir = "src\Whim.Runner\bin\${Architecture}\Release\net7.0-windows10.0.19041.0"
$buildDir = "src\Whim.Runner\bin\${Architecture}\Release\net8.0-windows10.0.19041.0"
$version = (Get-Item "${buildDir}\Whim.Runner.exe").VersionInfo.ProductVersion
$installerName = "WhimInstaller-${Architecture}-${version}"

Expand All @@ -23,7 +23,8 @@ $path = $output.Split("\n")[-1]
# Test if the installer exists.
if (Test-Path $path) {
return $path
} else {
}
else {
Write-Host "Failed to create installer"
Write-Host $output
exit 1
Expand Down
2 changes: 1 addition & 1 deletion src/Whim.Bar.Tests/Whim.Bar.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<Version>0.7.0</Version>
</PropertyGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Whim.Bar/Whim.Bar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<RootNamespace>Whim.Bar</RootNamespace>
<RuntimeIdentifiers>win10-x64;win10-arm64</RuntimeIdentifiers>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseWinUI>true</UseWinUI>
<Version>0.7.0</Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<Version>0.7.0</Version>
</PropertyGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Whim.CommandPalette/Whim.CommandPalette.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<GenerateLibraryLayout>true</GenerateLibraryLayout>
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<RuntimeIdentifiers>win10-x64;win10-arm64</RuntimeIdentifiers>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseWinUI>true</UseWinUI>
<Version>0.7.0</Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<Version>0.7.0</Version>
<RootNamespace>Whim.FloatingWindow.Tests</RootNamespace>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Whim.FloatingWindow/Whim.FloatingWindow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<GenerateLibraryLayout>true</GenerateLibraryLayout>
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<RuntimeIdentifiers>win10-x64;win10-arm64</RuntimeIdentifiers>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<Version>0.7.0</Version>
<RootNamespace>Whim.FloatingWindow</RootNamespace>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Whim.FocusIndicator/Whim.FocusIndicator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<RootNamespace>Whim.FocusIndicator</RootNamespace>
<RuntimeIdentifiers>win10-x64;win10-arm64</RuntimeIdentifiers>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseWinUI>true</UseWinUI>
<Version>0.7.0</Version>
Expand Down
2 changes: 1 addition & 1 deletion src/Whim.Gaps.Tests/Whim.Gaps.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<Version>0.7.0</Version>
</PropertyGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Whim.Gaps/Whim.Gaps.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<GenerateLibraryLayout>true</GenerateLibraryLayout>
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<RuntimeIdentifiers>win10-x64;win10-arm64</RuntimeIdentifiers>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<Version>0.7.0</Version>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<Version>0.7.0</Version>
</PropertyGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Whim.LayoutPreview/Whim.LayoutPreview.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<Nullable>enable</Nullable>
<Platforms>x64;arm64;Any CPU</Platforms>
<RootNamespace>Whim.LayoutPreview</RootNamespace>
<RuntimeIdentifiers>win10-x64;win10-arm64</RuntimeIdentifiers>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseWinUI>true</UseWinUI>
<Version>0.7.0</Version>
Expand Down
19 changes: 19 additions & 0 deletions src/Whim.Runner/Properties/PublishProfiles/win-arm64.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>arm64</Platform>
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun> <!--
See https://github.com/microsoft/CsWinRT/issues/373
<PublishTrimmed>True</PublishTrimmed>
-->
</PropertyGroup>
</Project>
20 changes: 20 additions & 0 deletions src/Whim.Runner/Properties/PublishProfiles/win-x64.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<!--
See https://github.com/microsoft/CsWinRT/issues/373
<PublishTrimmed>True</PublishTrimmed>
-->
</PropertyGroup>
</Project>
3 changes: 0 additions & 3 deletions src/Whim.Runner/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"profiles": {
"Whim.Runner (Package)": {
"commandName": "MsixPackage"
},
"Whim.Runner (Unpackaged)": {
"commandName": "Project"
}
Expand Down
Loading

0 comments on commit a286e32

Please sign in to comment.