2010-04-28 14 views
10

Pracuję nad projektem instalatora systemu Windows. A teraz chcę tylko oprogramowanie można zainstalować tylko w systemie Windows 7 lub Windows Server 2008 R2 systemu Windows Próbuję użyć tego:Jak sprawdzić system to Windows 7 lub Windows Server 2008 R2 w Instalatorze Wix?

<Condition Message='Windows Server 2008 R2 or Windows 7 is required'>(VersionNT = 600 AND ServicePackLevel = 1) OR VersionNT = 601 </Condition> 

ale to może jeszcze być zainstalowany w systemie Windows Vista. Proszę pomóż!

Dziękujemy!

+1

Tutaj masz Microsoft stronę o wersjach Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/aa370556(v=vs.85) .aspx –

Odpowiedz

9

Wystarczy sprawdzić VersionNT 601 lub nowszy, Windows 7 i Server 2008 R2 both have the same value.

<Condition Message="Win7 or 2008 R2 required"><![CDATA[Installed OR VersionNT >= 601]]></Condition> 
+0

dodatkowa uwaga: oryginalny plakat zapytał, jak sprawdzić jedną konkretną wersję systemu operacyjnego - używając operatora "=". to jest wielki błąd, który nigdy nie powinien zostać zrobiony! zamiast tego musimy użyć operatora "> =". jest to już uwzględnione w bieżącej odpowiedzi przez saschabeaumont. Chcę tylko podkreślić, że wymóg określony w pytaniu początkowym jest nieważny. musimy unikać takich błędów. – Opmet

1

Vista i Server 2008 pre-SP2 mają ten sam główny numer wersji. Musisz również znaleźć odpowiednik Wix dla "VER_NT_SERVER" (InstallShield). (Teraz w pracy, nie mają zainstalowane Wix tutaj)

22

Zobacz here na przykład

<Condition Message='Windows 95'>Version9X = 400</Condition> 
<Condition Message='Windows 95 OSR2.5'>Version9X = 400 AND WindowsBuild = 1111</Condition> 
<Condition Message='Windows 98'>Version9X = 410</Condition> 
<Condition Message='Windows 98 SE'>Version9X = 410 AND WindowsBuild = 2222</Condition> 
<Condition Message='Windows ME'>Version9X = 490</Condition> 
<Condition Message='Windows NT4'>VersionNT = 400</Condition> 
<Condition Message='Windows NT4 SPn'>VersionNT = 400 AND ServicePackLevel = n</Condition> 
<Condition Message='Windows 2000'>VersionNT = 500</Condition> 
<Condition Message='Windows 2000 SPn'>VersionNT = 500 AND ServicePackLevel = n</Condition> 
<Condition Message='Windows XP'>VersionNT = 501</Condition> 
<Condition Message='Windows XP SPn'>VersionNT = 501 AND ServicePackLevel = n</Condition> 
<Condition Message='Windows XP Home SPn'>VersionNT = 501 AND MsiNTSuitePersonal AND ServicePackLevel = n</Condition> 
<Condition Message='Windows Server 2003'>VersionNT = 502</Condition> 
<Condition Message='Windows Vista'>VersionNT = 600</Condition> 
<Condition Message='Windows Vista SP1'>VersionNT = 600 AND ServicePackLevel = 1</Condition> 
<Condition Message='Windows Server 2008'>VersionNT = 600 AND MsiNTProductType = 3</Condition> 
<Condition Message='Windows 7'>VersionNT = 601</Condition> 
<Condition Message='Windows 8'>VersionNT = 602</Condition> 
6

Możesz użyć właściwości MsiNTProductType, aby wykryć, czy jest to serwer os. W połączeniu z kontrolą wersji NT możesz sprawdzić, czy masz Windows Server 2008R2. To będzie wyglądać następująco:

<Condition Message="Windows Server 2008R2 required"> 
    <![CDATA[(VersionNT = 601 AND MsiNTProductType > 1) OR Installed]]> 
</Condition> 
Powiązane problemy