开发者

wix : Is it possible to create directory/folder by specifiying relative path

开发者 https://www.devze.com 2023-03-27 13:53 出处:网络
I need to specify path to create some database files(.mdf and .ldf) into it for my wix installer. Different computer probably have different version of sql server , so the path might be different from

I need to specify path to create some database files(.mdf and .ldf) into it for my wix installer. Different computer probably have different version of sql server , so the path might be different from (C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA) if my computer is using sql express. How can i get this path with wix? Is there any environment path or something similar like ProgramFilesFolder property which is equal to the full path of the Progra开发者_StackOverflow社区m Files based on individual computer settings.


If you open the registry, the path to the data path is stored in:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup

Note that if you're on a 64 bit system it would be:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\MSSQL.1\Setup

Note again that the MSSQL.1 portion of it is dependent on instance names. You can do a lookup from instance name to that variable by searching the registry here:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL

I believe this will have more info: http://technet.microsoft.com/en-us/library/ms143547(SQL.90).aspx

I assume that the default instance may be slightly different, but the machine I have has a named instance. It may be possible to get these values via a SQL query or through Sql Management Objects as well. I'm not sure what the best way to go about it is.

Once you get one of those values, you can put it in a property and manipulate the destination directory from there.

0

精彩评论

暂无评论...
验证码 换一张
取 消