Skip to content

Commit cb61400

Browse files
authored
build: fix Visual Studio build (#4300)
* ci: add msbuild job * fix: build with Visual Studio > Sentry.Native.targets(37,14): error MSB4186: Invalid static method invocation syntax: > "[System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier". > Method 'System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier' not found. > Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). > Check that all parameters are defined, are of the correct type, and are specified in the right order.
1 parent 01c6b86 commit cb61400

File tree

2 files changed

+45
-5
lines changed

2 files changed

+45
-5
lines changed

.github/workflows/build.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,46 @@ jobs:
218218
with:
219219
path: integration-test
220220

221+
msbuild:
222+
needs: build-sentry-native
223+
name: MSBuild
224+
runs-on: windows-latest
225+
226+
steps:
227+
- name: Checkout
228+
uses: actions/checkout@v4
229+
with:
230+
submodules: recursive
231+
232+
- name: Download sentry-native (Windows)
233+
uses: actions/cache/restore@v4
234+
with:
235+
path: src/Sentry/Platforms/Native/sentry-native
236+
key: sentry-native-Windows-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
237+
fail-on-cache-miss: true
238+
enableCrossOsArchive: true
239+
240+
- name: Setup Environment
241+
uses: ./.github/actions/environment
242+
243+
- name: Build Native Dependencies
244+
uses: ./.github/actions/buildnative
245+
246+
- name: Setup MSBuild
247+
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2
248+
249+
- name: Run MSBuild
250+
id: msbuild
251+
run: msbuild Sentry-CI-Build-Windows.slnf -t:Restore,Build -p:Configuration=Release --nologo -v:minimal -flp:logfile=msbuild.log -p:CopyLocalLockFileAssemblies=true -bl:msbuild.binlog
252+
253+
- name: Upload logs
254+
if: ${{ steps.msbuild.outcome != 'skipped' }}
255+
uses: actions/upload-artifact@v4
256+
with:
257+
name: ${{ matrix.target || runner.os }}-msbuild-logs
258+
path: |
259+
msbuild.log
260+
msbuild.binlog
221261
222262
trim-analysis:
223263
needs: build-sentry-native

src/Sentry/Platforms/Native/Sentry.Native.targets

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,35 @@
3434
</ItemGroup>
3535

3636
<!-- Packaging the native library (NOTE: $(RuntimeIdentifier) is not set) -->
37-
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)' == 'win-x64'">
37+
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$(NETCoreSdkRuntimeIdentifier)' == 'win-x64'">
3838
<None Include="$(SentryNativeOutputDirectory-win-x64)$(SentryNativeLibraryName).lib">
3939
<Pack>true</Pack>
4040
<PackagePath>\sentry-native\$(NativeLibRelativePath-win-x64)</PackagePath>
4141
</None>
4242
</ItemGroup>
4343

44-
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)' == 'win-arm64'">
44+
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$(NETCoreSdkRuntimeIdentifier)' == 'win-arm64'">
4545
<None Include="$(SentryNativeOutputDirectory-win-arm64)$(SentryNativeLibraryName).lib">
4646
<Pack>true</Pack>
4747
<PackagePath>\sentry-native\$(NativeLibRelativePath-win-arm64)</PackagePath>
4848
</None>
4949
</ItemGroup>
5050

51-
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)' == 'linux-x64'">
51+
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$(NETCoreSdkRuntimeIdentifier)' == 'linux-x64'">
5252
<None Include="$(SentryNativeOutputDirectory-linux-x64)lib$(SentryNativeLibraryName).a">
5353
<Pack>true</Pack>
5454
<PackagePath>\sentry-native\$(NativeLibRelativePath-linux-x64)</PackagePath>
5555
</None>
5656
</ItemGroup>
5757

58-
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)' == 'linux-musl-x64'">
58+
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$(NETCoreSdkRuntimeIdentifier)' == 'linux-musl-x64'">
5959
<None Include="$(SentryNativeOutputDirectory-linux-musl-x64)lib$(SentryNativeLibraryName).a">
6060
<Pack>true</Pack>
6161
<PackagePath>\sentry-native\$(NativeLibRelativePath-linux-musl-x64)</PackagePath>
6262
</None>
6363
</ItemGroup>
6464

65-
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)' == 'linux-arm64'">
65+
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$(NETCoreSdkRuntimeIdentifier)' == 'linux-arm64'">
6666
<None Include="$(SentryNativeOutputDirectory-linux-arm64)lib$(SentryNativeLibraryName).a">
6767
<Pack>true</Pack>
6868
<PackagePath>\sentry-native\$(NativeLibRelativePath-linux-arm64)</PackagePath>

0 commit comments

Comments
 (0)