Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 4

InstallScript Project problem: OnInstalled + SQL database


I've hit a following issue:

I have an InstallScript project.
In it I have a feature associated with few SQL script components that upgrade existing SQL Server database (schema changes, script changes, new data inserted to some tables). Since the changes are deeper and cannot be simply handled by SQL scripts, I got from devs .exe tool that needs to be executed after the scripts that does the rest of upgrading.
So I've discovered that there's this nice 'OnInstalled' part that allows me to select InstallScript function to execute when the feature is installed - at least that's what I'm being told by the IDE.
So I have such function where I call this tool. Unfortunately, when executed, the tool throws exceptions that point to conclusion, that it is being executed before changes to database schema are committed. When I manually launch the tool shortly after - it works like a charm.

Is this a known bug or just it so happens to work this way?
Labels (1)
0 Kudos
(1) Reply
Level 10 Flexeran
Level 10 Flexeran

A feature installed event should run after any SQL scripts included in any components in the feature. An exception to this would be if batch mode is enabled for SQL scripts, in which case the SQL scripts will not run until after the feature installed event is sent (the OnSQLBatchScripts or OnMoved events could be used in this case).
0 Kudos