1

I have to create tables inside already existing database While I run my mis package it through error for garbage character which I trace out using sql profiler. How to solve this issue my code is following

 <?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"
     xmlns:sql="http://wixtoolset.org/schemas/v4/wxs/sql"
     >
  <Product Id="*" Name="GAT.DATAC.Deployment.Database" Language="1033" Version="1.0.0.0" Manufacturer="Gat" UpgradeCode="f5e8f09a-7df7-4699-9670-65f9f4003c58">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />


    <!--<util:User Id="SQLUser" Name="test" Password="ba" />-->
    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='InstallDir' Name='Acme'>

          <Component Id='SqlComponent' Guid='8A1C82DB-1DD3-4FB5-8600-4F370FE1E04B' KeyPath='yes'>

            <sql:SqlDatabase Id="SqlDatabase" Database="dbGATAC" Server="PC4" CreateOnInstall="yes" DropOnUninstall="yes" ContinueOnError="no">
              <!--User="SQLUserSA"-->
              <sql:SqlScript Id='CreateTable' BinaryKey='CreateTablesBin' ExecuteOnInstall='yes' />
            </sql:SqlDatabase>
            <!--<sql:SqlScript Id="CreateTables" ExecuteOnInstall="yes" SqlDb="SqlDatabase.IntegratedAuthentication"  ExecuteOnUninstall="no" BinaryKey="CreateTablesBin" ContinueOnError="no" />-->
            <CreateFolder/>

          </Component>

        </Directory>
      </Directory>
    </Directory>

    <Binary Id='CreateTablesBin' SourceFile='DatabaseSchema\SqlCreateDb.sql' />

    <Feature Id='SqlFeature' Title='SqlFeature' Level='1'>
      <ComponentRef Id='SqlComponent' />
    </Feature>

  </Product>
</Wix>

and while I run it display following script for execution in profiler

exec CREATE TABLE [dbo].[Widgets] (
        [Id] [uniqueidentifier] NOT NULL,
        [Configuration] [nvarchar](max) NOT NULL,
        [Dashboard_Id] [uniqueidentifier],
        CONSTRAINT [PK_dbo.Widgets] PRIMARY KEY ([Id])
    )

Now  is inserted by wix installer and restricting my script to execute.

zaheer ahmad
  • 294
  • 4
  • 16
  • Just noticed that you seem to be using "nightly build" release of WIX (v4.x)? Is it on purpose, or by mistake? If by mistake, try the latest stable version (3.10.2) – Nikolay May 07 '16 at 14:12
  • Thank you nikolay for you text I have solved this issue I jst need to save this file as utf-8 without signature and it works and I want newer version so that is why used latest version – zaheer ahmad May 08 '16 at 05:29
  • Okay, so that was UTF-8 BOM marker then. Good that the issue solved :) – Nikolay May 08 '16 at 13:56
  • @zaheerahmad You can write this as answer (and accept it). Also consider filing this as a bug in WiX (or at least the documentation). – Tom Blodget May 08 '16 at 18:32
  • Thank you @TomBlodget yes I am adding this as answer – zaheer ahmad May 09 '16 at 13:20

1 Answers1

1

I solved this issue after saving my file with utf-8 without signature and it works for me. It kind a bug in Wix.

zaheer ahmad
  • 294
  • 4
  • 16