diff --git a/.github/workflows/build-validation.yml b/.github/workflows/build-validation.yml index 30a5afd..1028501 100644 --- a/.github/workflows/build-validation.yml +++ b/.github/workflows/build-validation.yml @@ -10,7 +10,7 @@ on: env: DOTNET_INSTALLER_CHANNEL: '6.0' - DOTNET_DO_INSTALL: 'true' + DOTNET_DO_INSTALL: 'false' EnableNuGetPackageRestore: 'True' # A workflow run is made up of one or more jobs that can run sequentially or in parallel @@ -18,7 +18,7 @@ jobs: # This workflow contains a single job called "snippets-build" snippets-build: # The type of runner that the job will run on - runs-on: windows-latest + runs-on: windows-2022 permissions: statuses: write @@ -35,7 +35,7 @@ jobs: Invoke-WebRequest https://raw.githubusercontent.com/dotnet/install-scripts/master/src/dotnet-install.ps1 -OutFile dotnet-install.ps1 echo "Installing dotnet version ${{ env.DOTNET_INSTALLER_CHANNEL }}" .\dotnet-install.ps1 -InstallDir "c:\program files\dotnet" -Channel "${{ env.DOTNET_INSTALLER_CHANNEL }}" - + # Print dotnet info - name: Display .NET info run: | diff --git a/.github/workflows/dependencies/Get-MSBuildResults.ps1 b/.github/workflows/dependencies/Get-MSBuildResults.ps1 index 6a96c7f..0fb2f4d 100644 --- a/.github/workflows/dependencies/Get-MSBuildResults.ps1 +++ b/.github/workflows/dependencies/Get-MSBuildResults.ps1 @@ -31,10 +31,11 @@ None .NOTES - Version: 1.3 + Version: 1.5 Author: adegeo@microsoft.com - Creation Date: 07/02/2020 - Purpose/Change: Add support for config file. Select distinct on project files. + Creation Date: 12/11/2020 + Update Date: 02/17/2022 + Purpose/Change: Move to VS 2022. #> [CmdletBinding()] @@ -133,7 +134,7 @@ foreach ($item in $workingSet) { if ([int]$data[0] -eq 0) { $projectFile = Resolve-Path "$RepoRootDir\$($data[2])" $configFile = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($projectFile), "snippets.5000.json") - + # Create the default build command "dotnet build `"$projectFile`"" | Out-File ".\run.bat" @@ -147,13 +148,30 @@ foreach ($item in $workingSet) { Write-Host "- Using visual studio as build host" # Create the visual studio build command - "CALL `"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat`"`n" + + "CALL `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat`"`n" + "msbuild.exe `"$projectFile`" -restore:True" ` | Out-File ".\run.bat" } + elseif ($settings.host -eq "custom") { + Write-Host "- Using custom build host: $($settings.command)" + + $ExecutionContext.InvokeCommand.ExpandString($settings.command) | Out-File ".\run.bat" + } + elseif ($settings.host -eq "dotnet") { + Write-Host "- Using dotnet build host" + + "dotnet build `"$projectFile`"" | Out-File ".\run.bat" + } + else { + throw "snippets.5000.json file isn't valid." + } } - $result = Invoke-Expression ".\run.bat" | Out-String + Write-Host "run.bat contents: " + Get-Content .\run.bat | Write-Host + Write-Host + + Invoke-Expression ".\run.bat" | Tee-Object -Variable "result" $thisExitCode = 0 if ($LASTEXITCODE -ne 0) { @@ -172,7 +190,7 @@ foreach ($item in $workingSet) { # Too many projects found elseif ([int]$data[0] -eq 2) { - New-Result $data[1] $data[2] 2 "😕 Too many projects found. A single project or solution must existing in this directory or one of the parent directories." + New-Result $data[1] $data[2] 2 "😕 Too many projects found. A single project or solution must exist in this directory or one of the parent directories." $thisExitCode = 2 } diff --git a/dotnet-desktop-guide/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md b/dotnet-desktop-guide/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md index 3f6352b..70e0296 100644 --- a/dotnet-desktop-guide/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md +++ b/dotnet-desktop-guide/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md @@ -211,6 +211,8 @@ In this section, you'll add two pages and an image to the application. 2. In the **Add Existing Item** dialog, set the file filter to either **All Files** or **Image Files**, browse to the image file you want to use, and then select **Add**. + 3. Select the image file in **Solution Explorer**, then in the **Properties** window, set **Build Action** to **Resource**. + ## Build and run the application 1. To build and run the application, press **F5** or select **Start Debugging** from the **Debug** menu.