I'm trying to install a database with WIX.
I've already installed SQL Server 2008 express on my Windows7 (32 Bit). On this installation, TCP/IP is enabled, SQL Server service is running.
I'm using SQL Server and Windows authentication for SQL Server. I tried both in the code - I added a user in the component.
The code is very basic :
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension">
<Product Id="*" Name="NewDatabaseInstaller" Language="1033"
Version="1.0.0.0" Manufacturer="My Company"
UpgradeCode="17ef693b-3ab5-4788-a6b5-70eeabc13497">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="NewDatabaseInstaller" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="NewDatabaseInstaller" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="cmpSqlDatabase" Guid="{F950605D-AA59-43E6-AB19-9452F6BEC649}" KeyPath="yes">
<sql:SqlDatabase Id="sqlDatabase_MyDatabase" Server="localhost"
Instance="MSSQLSERVER" Database="MyDatabase"
CreateOnInstall="yes" DropOnUninstall="yes"
ContinueOnError="no" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
I had the instance name by taping this query in the Management studio :
SELECT ##servicename
However, I get an error :
CreateDatabase: Error 0x80004005: failed to create to database: 'MyDatabase', error: unknown error
Error 26201. Error -2147467259: failed to create SQL database: MyDatabase, error detail: unknown error.
MSI (s) (FC!74) [17:43:27:786]: Product: Test -- Error 26201. Error -2147467259: failed to create SQL database: MyDatabase, error detail: unknown error.
CustomAction CreateDatabase returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 17:43:27: InstallFinalize. Return value 3.
Did I miss something?
Thanks !
I found my problem.
I'm ashamed of my error : I put a instance
Instance="MSSQLSERVER"
I did not need it. I thought it was the
SELECT ##servicename
So, I don't know when we need it... Did someone know?
Thanks Yan for your help!
Related
I have created a .wixproj installer for my WPF program which successfully installs my WPF application. I now want to add the installation of a device driver as part of this installation as this device is required for using certain parts of the WPF app. However, having included the driver files in their own component and using the DIFX Driver tag, the installer project can be built but the installation fails when it gets to the DIFX component.
I have one file, Drivers.wxs, where I create the components and use the DIFXAPP Driver tag:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns=http://schemas.microsoft.com/wix/2006/wi
xmlns:difx=http://schemas.microsoft.com/wix/DifxAppExtension>
<Fragment>
<ComponentGroup Id="Drivers">
<ComponentRef Id="cyusb"/>
</ComponentGroup>
<DirectoryRef Id="INSTALLFOLDER" FileSource="..\Installer\drivers">
<Directory Id='DriverFolder' Name='Drivers'>
<Directory Id='CYUSBFolder' Name='CyUSB'>
<Component Id="cyusb" Guid="{6125BDA1-74B9-443C-B130-494C60367EA4}">
<File Id="cyusb.sys" Name="CyUSBsys" Vital="yes" Source=".\drivers\cyusb\cyusb3.sys" KeyPath="yes" />
<File Id="cyusb.cat" Name="CyUSBcat" Vital="yes" Source=".\drivers\cyusb\cy_devices.cat" />
<File Id="cyusb.inf" Name="CyUSBinf" Vital="yes" Source=".\drivers\cyusb\Cy_Devices.inf" />
<difx:Driver Legacy="yes"/>
</Component>
</Directory>
</Directory>
</DirectoryRef>
</Fragment>
</Wix>
Then I reference this component group in my Product.wxs within the product tag alongside all my other features:
<!--Define components, shortcuts, files etc for installer-->
<Feature Id="ProductFeature" Title="AnalytacleClientInstaller" Level="1">
<ComponentGroupRef Id="Drivers"/>
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="CompiledComponents"/>
<ComponentGroupRef Id="FileTypeComponents"/>
</Feature>
I have also added the DifxAppExtension as a reference for my project and added the Difx library reference within the .wixProj file itself :
<WixLibrary Include="difxapp_x64.wixlib">
<HintPath>difxapp_x64.wixlib</HintPath>
<Name>difxapp_x64.wixlib</Name>
</WixLibrary>
There are no errors or warnings and I am able to build my installer just fine, but when I run the install it fails with the same error message each time, here is a snippet from the log where DIFXAPP starts:
DIFXAPP: ENTER: InstallDriverPackages()
DIFXAPP: INFO: 'CustomActionData' property 'DIFxApp Version' is '2.1'.
DIFXAPP: INFO: 'CustomActionData' property 'UI Level' is '2'.
DIFXAPP: INFO: 'CustomActionData' property 'componentId' is '{6125BDA1-74B9-443C-B130-494C60367EA4}'.
DIFXAPP: INFO: 'CustomActionData' property 'componentPath' is 'C:\Program Files (x86)\MyProj\Drivers\CyUSB\'.
DIFXAPP: INFO: 'CustomActionData' property 'flags' is 0x8.
DIFXAPP: INFO: 'CustomActionData' property 'installState' is '2'.
DIFXAPP: INFO: 'CustomActionData' property 'ProductName' is 'MyProj'.
DIFXAPP: INFO: 'CustomActionData' property 'ManufacturerName' is 'manufacturer'.
DIFXAPP: INFO: user SID of user performing the install is 'S-1-5-21-1332366759-4080576608-3295227165-1001'.
DIFXAPP: INFO: opening HKEY_USERS\S-1-5-21-1332366759-4080576608-3295227165-1001\Software\Microsoft\Windows\CurrentVersion\DIFxApp\Components\{6125BDA1-74B9-443C-B130-494C60367EA4} (User's SID: 'S-1-5-21-1332366759-4080576608-3295227165-1001') ...
DIFXAPP: ERROR: no driver packages found in C:\Program Files (x86)\MyProj\Drivers\CyUSB\
DIFXAPP: ERROR: InstallDriverPackages failed with error 0x2
DIFXAPP: RETURN: InstallDriverPackages() 2 (0x2)
CustomAction MsiInstallDrivers returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
If I remove the <difx:Driver> tag then installation completes successfully and the .inf, .cat and .sys files all appear in C:\Program Files (x86)\MyProj\Drivers\CyUSB\ where DIFX is looking for them. I’ve not installed drivers before with WiX Toolset, please let me know what I’ve missed or if I should be taking a different approach entirely!
Thanks very much for any help
I'm running into an issue with an invalid URI when attempting to run the Wix V3.11.2 toolset via Powershell. I'm not sure what is causing the error.
Full error:
$ candle.exe Product.wxs
Windows Installer XML Toolset Compiler version 3.11.2.4516
Copyright (c) .NET Foundation and contributors. All rights reserved.
Product.wxs
candle.exe : error CNDL0001 : Invalid URI: The hostname could not be parsed.
Exception Type: System.UriFormatException
Stack Trace:
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at Microsoft.Tools.WindowsInstallerXml.Preprocessor.Process(String sourceFile, Hashtable variables)
at Microsoft.Tools.WindowsInstallerXml.Tools.Candle.Run(String[] args)
The test file I'm using:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="My Software"
Language="1033"
Manufacturer="My Company"
Version="1.0.0.0"
UpgradeCode="GUID-HERE">
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature"
Title="The main feature"
Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
</Wix>
I replaced the UpgradeCode with a placeholder for this post; a unique code
is there when I run it. I've tried installing via the download button from the official site, installing via github exe download, and installing via dotnet tool install. All 3 instances give me the same error. I'm hoping I'm missing something simple.
Figured it out. Turns out, that is the error message received if the .NET installation is the wrong version, but WiX ends up being installed anyways. For WiX V3.11, the .NET 3.5 framework is needed.
I'm trying to create a setup file (MSI) that runs without admin privileges. for that, I've tried the bellow option.
I've set InstallAlluser property to false as bellow.
Also set InstallAllUsersVisible to false
I've also changed Default location with [AppDataFolder]
After changes above properties It still required Administrator permission to execute MSI file that created using Setup project.
Can you please help me to resolve this issue.
Thanks in Advance.
When you open your MSI with Orca (or equivalent MSI viewer), do you see the "UAC Compliant" check box checked? Sample screenshot here:
You should really use a more flexible and capable MSI tool than the Visual Studio Installer projects. They are good for a few purposes, but lack flexibility and there are numerous other problems: summary of VS Project problems (short form).
Per-User setups considered harmful: Some words of warning against per user setups. Here is one more answer on that.
A simple per-user folder installation in WiX (insert UPPERCASE GUIDs in locations shown with "PUT-GUID-HERE" (2 occurrences) - you can use this GUID generator):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="PerUserSample" Language="1033" Version="1.0.0.0" Manufacturer="-" UpgradeCode="PUT-GUID-HERE">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" InstallPrivileges="limited" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<UIRef Id="WixUI_Mondo" />
<Feature Id="ProductFeature" Title="PerUserSample" Level="1" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="AppDataFolder">
<Directory Id="Something" Name="Something">
<Component Feature="ProductFeature" Guid="PUT-GUID-HERE">
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\Test"
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<File Source="C:\Windows\Notepad.exe" />
<RemoveFolder Id="Something" Directory="Something" On="uninstall" />
</Component>
</Directory>
</Directory>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="PerUserSample" />
</Directory>
</Directory>
</Product>
</Wix>
I have a MVC4/ASP.Net application that uses localdb. Everything "appears" to work correctly. However I am getting loads of errors in my event log:
The "DataDirectory" registry value is missing in the LocalDB instance registry key: {BB3F4304-E7E9-4EE7-9A25-B46BFAA73FB4}
The "DataDirectory" registry value is missing in the LocalDB instance registry key: {BB31321B-BEB9-465B-8C8E-DEF9C2C67FBE}
Each time the instance changes.
XML Detail of the error:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="SQLLocalDB 11.0" />
<EventID Qualifiers="35269">512</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-03-12T14:12:43.000000000Z" />
<EventRecordID>1080755</EventRecordID>
<Channel>Application</Channel>
<Computer>XXXXXX</Computer>
<Security />
</System>
<EventData>
<Data>{BB07CF13-2ABD-4FD5-AB2B-467FF08F28E6}</Data>
</EventData>
</Event>
Connection string:
<add
name="DefaultConnection"
connectionString="Data Source=(localdb)\v11.0; Initial Catalog=WebMVCContext-20121205135209; Integrated Security=True; MultipleActiveResultSets=True; AttachDbFilename=|DataDirectory|WebMVCContext-20121205135209.mdf"
providerName="System.Data.SqlClient" />
Again, it is working and everything is connecting just get 10-20 of these for every connection.
I have the same issue. It seems like a bug of Localdb.
I have solved this issue by deleting the registry key:
HKEY_USERS\.DEFAULT\Software\Microsoft\Microsoft SQL Server\UserInstances\[GUID_FROM_EVENT_LOG]
I have a SQL Server (2012) project in VS2013. I also have an app.config with Local configuration and [tfsbuildserver].sqlunittest.config with server connection string and a relative path.
When performing a check-in executes a build definition that makes deploy and run the tests. The deploy done correctly, but when tests throws me the following error:
An error occurred while SQL Server unit testing settings were being read from the configuration file. Click the test project, open the
SQL Server Test Configuration dialog box from the SQL menu, add the
settings to the dialog box, and rebuild the project.
app.config:
<configuration>
<configSections>
<section name="SqlUnitTesting" type="Microsoft.Data.Tools.Schema.Sql.UnitTesting.Configuration.SqlUnitTestingSection, Microsoft.Data.Tools.Schema.Sql.UnitTesting, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<SqlUnitTesting AllowConfigurationOverride="true">
<DatabaseDeployment DatabaseProjectFileName="[RELATIVEPATHLOCAL]"
Configuration="Release" />
<DataGeneration ClearDatabase="true" />
<ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=[LOCALSERVER];Initial Catalog=[DATABASE];Integrated Security=True;Pooling=False"
CommandTimeout="30" />
<PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=[LOCALSERVER];Initial Catalog=[DATABASE];Integrated Security=True;Pooling=False"
CommandTimeout="30" />
</SqlUnitTesting>
</configuration>
[tfsbuildserver].sqlunittesting.config:
<SqlUnitTesting>
<DatabaseDeployment DatabaseProjectFileName="[RELATIVEPATHTFS]"
Configuration="Release" />
<DataGeneration ClearDatabase="true" />
<ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=[SERVERTEST];Initial Catalog=[DATABASETEST];Persist Security Info=True;User ID=[USER];Password=[PASS];Pooling=False"
CommandTimeout="30" />
<PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=[SERVERTEST];Initial Catalog=[DATABASETEST];Persist Security Info=True;User ID=[USER];Password=[PASS];Pooling=False"
CommandTimeout="30" />
</SqlUnitTesting>
Tests run correctly locally. The error occurs when performing the build definition
Sorry for my English.
Thanks
Turns out the issue was that I had leading white space before the <SqlUnitTesting>, once these were removed the test ran as expected and remove
<?xml version="1.0" encoding="utf-8" ?>
URL: Link Resolved