---
lang: ja-jp
breaks: true
---
# C# `Environment.OSVersion` で正しいバージョンを取得するには、マニュフェストファイルの設定が必須となる 2022-03-23
> アプリケーションマニフェスト
> 互換性
> supportedOS
> https://docs.microsoft.com/ja-jp/windows/win32/sbscs/application-manifests#supportedos
```xml=
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
・・・
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- このアプリケーションがテストされ、動作するよう設計された Windows バージョンの
一覧。適切な要素をコメント解除すると、最も互換性のある環境を Windows が
自動的に選択します。-->
<!-- Windows Vista および Windows Server 2008 -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
<!-- Windows 7 および Windows Server 2008 R2 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows 8 and Windows Server 2012 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 および Windows Server 2012 R2 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10,Windows 11, Windows Server 2016, Windows Server 2019 および Windows Server 2022 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
・・・
</assembly>
```
:::info
Vista 機能を使用してアプリケーションを実行するには、Id 属性を {e2011457-1546-43c5-a5fe-008deee3d3f0} に設定します。 これにより、Windows Vista 用に設計されたアプリケーションを、後のオペレーティング システムで実行できます。
id 属性を {35138b9a-5d96-4fbd-8e2d-a2440225f93a} に設定して、Windows 7 の機能を使用してアプリケーションを実行します。
Vista、Windows 7、Windows機能をWindows 8するアプリケーションでは、個別のマニフェストは必要ではありません。 この場合は、すべてのオペレーティング システムの GUID をWindowsします。
Id 属性 の動作 の詳細については、「Windows Compatibility Cookbook Windows 8 Windows Server 2012を参照してください。
#### 次の GUID は、指定されたオペレーティング システムに対応しています。
* {8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a} -> Windows 10,Windows 11, Windows Server 2016, Windows Server 2019 および Windows Server 2022
* {1f676c76-80e1-4239-95bb-83d0f6d0da78} -> Windows 8.1 および Windows Server 2012 R2
* {4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38} -> Windows 8 and Windows Server 2012
* {35138b9a-5d96-4fbd-8e2d-a2440225f93a} -> Windows 7 および Windows Server 2008 R2
* {e2011457-1546-43c5-a5fe-008deee3d3f0} -> Windows Vista および Windows Server 2008
Windows 7 または Windows 8.x でこれをテストするには、リソース モニター (resmon) を実行し、[CPU] タブに移動し、列ラベルを右クリックして [列の選択...] を選択し、[オペレーティング システム コンテキスト] をオンにします。 Windows 8.x では、この列は タスク マネージャー (taskmgr) で使用できます。 列の内容には、検出された最も高い値または "Windows Vista" が既定値として表示されます。
:::
## Operating System Version
https://docs.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version
Operating system | Version number
-- | --
Windows 11 | 10.0※
Windows 10 | 10.0※
Windows Server 2022 | 10.0※
Windows Server 2019 | 10.0※
Windows Server 2016 | 10.0※
Windows 8.1 | 6.3※
Windows Server 2012 R2 | 6.3※
Windows 8 | 6.2
Windows Server 2012 | 6.2
Windows 7 | 6.1
Windows Server 2008 R2 | 6.1
Windows Server 2008 | 6
Windows Vista | 6
Windows Server 2003 R2 | 5.2
Windows Server 2003 | 5.2
Windows XP 64-Bit Edition | 5.2
Windows XP | 5.1
Windows 2000 | 5
:::info
※Windows 8.1 または Windows 10 用にマニフェストされたアプリケーションが対象です。
※Windows 8.1またはWindows 10向けにマニフェストされていないアプリケーションは、Windows 8のOSバージョン値(6.2)が返されます。
:::
###### tags: `C#` `Environment.OSVersion` `マニュフェストファイル` `app.manifest`