我正在尋找一種方法來確定在WiX中是否安裝了SQLLocalDB。我怎樣才能做到這一點? - 我可以檢查註冊表項嗎? - 當是,哪個鍵?確定是否安裝了SqlLocalDB
2
A
回答
4
一個RegistrySearch應該這樣做:
<Property Id="LOCALDB">
<RegistrySearch Id="SearchForLocalDB" Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11E.LOCALDB\MSSQLServer\CurrentVersion"
Name="CurrentVersion"
Type="raw" />
</Property>
這將讓你的版本。
+0
根據MSDN,AppSearch屬性必須是公共屬性。 http://msdn.microsoft.com/en-us/library/windows/desktop/aa367579%28v=vs.85%29.aspx和ICE52警告。 – 2013-03-18 21:39:10
+0
是的,在捆綁中的時間太多了。 :)修正。 – 2013-03-19 14:12:34
0
從註冊表中檢查可能無法一直工作,因爲如果用戶卸載localDb,則註冊表項可能仍然存在。
這裏是我使用來識別命令行中的LocalDB安裝的功能 -
internal static bool IsLocalDBInstalled()
{
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/C sqllocaldb info";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.Start();
// Do not wait for the child process to exit before
// reading to the end of its redirected stream.
// p.WaitForExit();
// Read the output stream first and then wait.
string sOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit();
//If LocalDb is not installed then it will return that 'sqllocaldb' is not recognized as an internal or external command operable program or batch file.
if (sOutput == null || sOutput.Trim().Length == 0 || sOutput.Contains("not recognized"))
return false;
if (sOutput.ToLower().Contains("mssqllocaldb")) //This is a defualt instance in local DB
return true;
return false;
}
相關問題
- 1. 確定是否安裝了Flash OCX?
- 2. 我是否正確安裝了Xcode?
- 3. 確定是否安裝了Google地球(在Windows上)
- 4. 如何確定驅動器是否安裝了TrueCrypt?
- 5. 確定是否安裝了.NET 3.5的最佳方式
- 6. 如何確定用戶是否安裝了iOS應用程序?
- 7. 如何確定我是否安裝了本地SQL Server 2008 R2
- 8. 如何確定網頁用戶是否安裝了字體?
- 9. 以編程方式確定是否安裝了Racket軟件包
- 10. 確定是否可以安裝Silverlight
- 11. 確定是否新安裝或更新
- 12. 如何檢查我是否已正確安裝了pymunk
- 13. 確認/檢查iPhone上是否安裝了配置文件
- 14. Android:如何確定Google Play服務是否已正確安裝
- 15. Autoconf:檢測是否安裝了emacs
- 16. Swashbuckle是否也安裝了Swagger UI?
- 17. 檢查Java是否安裝了Bash
- 18. 檢測是否安裝了Exchange MAPI
- 19. GWT檢查是否安裝了閃存
- 20. gwt檢查是否安裝了jre
- 21. 檢查是否安裝了dll
- 22. 如何檢測是否安裝了numpy
- 23. 檢查是否安裝了Yahoo Messenger
- 24. 檢測Mod_Security是否安裝了PHP?
- 25. 檢查是否安裝了J#框架
- 26. PHP檢測是否安裝了閃存
- 27. 檢測是否安裝了ADOBE
- 28. 查找是否安裝了libbdd
- 29. 檢查是否安裝了軟件包
- 30. 檢查是否安裝了咕嚕聲?
http://msdn.microsoft.com/en-us/library/hh215237.aspx – ErikEJ 2013-03-18 21:06:22
就個人而言,我更喜歡測試與數據庫實例的連接,而不是將自己連接到特定的實例/版本。 – 2013-03-18 21:41:19
@christopher畫家 - 我如何在WiX上做這個決定是否安裝LocalDB? – BennoDual 2013-03-18 22:33:00