Sir Sir 我試圖從C#中的app.manifest中獲得10的勝利,但它似乎不工作。從app.manifest C#靶向贏得10#
app.manifest
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v1">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="highestAvailable" uiAccess="true" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on and is
is designed to work with. Uncomment the appropriate elements and Windows will
automatically selected the most compatible environment. -->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
</application>
</compatibility>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
</assembly>
的Environment.OSVersion.Version返回仍然是V6.2。
另外,我想知道在哪裏包括
_NT_TARGET_VERSION = $(_NT_TARGET_VERSION_LATEST)
當微軟承諾打敗版本號檢查時,微軟並不是在開玩笑。你必須使用FileVersionInfo類,kernel32.dll總是在附近。 –
@HansPassant不,你沒有。坦率地說,這是可怕的建議。微軟沒有義務更新文件版本。沒有理由首先檢測操作系統版本。 – EKW
你們兩個都不正確:據說,如果清單中包含正確的密鑰,MS通常會支持舊版本檢查!第二:「沒有什麼理由可以檢測到」..嗯..你說的對,很多開發者使用它是錯誤的,阻礙了在現代Windows版本上運行應用程序。在「標準」應用程序中應該避免使用它,但有很多原因可以滿足您的需要。在設置中,以及在不同Windows版本中工作的不同情況。像.NET一樣激活Windows功能的細節行爲完全不同。 – Philm