I try to build a native .NET application with Github actions. After 2 days of trying and searching i will ask here.
The project is a solution with .NET 4.6.1 and React Native (both not updateable for legacy code reasons).
When i run the ci it always tell me this:
C:Program Files (x86)Microsoft Visual Studio2019EnterpriseMSBuildMicrosoftVCv160Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0.18362.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution"
Here is my Github action code:
name: Build
on: [push]
jobs:
build:
name: "Build Termnial"
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
UseEnv: true
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Setup MSBuild
uses: microsoft/[email protected]
with:
msbuild-architecture: x64
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Build key file
env:
CERT_FILE: ${{ secrets.CERT_FILE }}
shell: bash
run: |
echo "$CERT_FILE" > sideloading.base64
certutil -decode sideloading.base64 SideloadingMaster.pfx
- name: Install dependencies Node.js
run: npm ci --legacy-peer-deps
- uses: GuillaumeFalourd/[email protected]
- name: Install Framework
run: |
choco install dotnet4.6.1
choco install dotnet4.6.1-devpack
- name: Build Terminal
# run: dotnet build --nologo --configuration Release -p:PackageCertificateKeyFile="SideloadingMaster.pfx" windows/project.sln
run: msbuild .windowsproject.sln /nologo -verbosity:minimal /p:Configuration=Release /p:Platform=x64 /p:AppxBundle=Never /bl /p:PackageCertificateKeyFile="SideloadingMaster.pfx" /p:RestorePackagesConfig=true /t:restore,build
I’m not sure what is wrong here and i’m not a .NET guy. So please help me someone.
2
Answers
I fixed it myself.
It seems that the
setup-node
and thesetup-msbuild
actions where causing the problems. The windows runner comes with both preinstalled and the setup actions are messing with it. But you still have to install the correct windows sdk if it is not listed in theGather environment info
stepHere is the working workflow file:
Got this information here microsoft/react-native-windows-samples within the
.github
folder.And thanks to VonC for trying to help me.
As in
GuillaumeFalourd/setup-windows10-sdk-action
issue 3, check if the action shows the default 18362 SDK did download successfully.If you have any error message ("
iso was not found
") or "The remote server returned an error: (400) Bad Request
", that would explain why the rest of the action does not find that SDK.You can also add an additional step to list the installed Windows SDKs. This will help to debug and identify if the required SDK version is installed correctly.