Setting A Windows Service Dependancy

windows

November 21, 2013 | Posted in Windows

1. Open the registry editor:
Start -> Run -> regedit

2. Navigate to the specific service you are trying to delay:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\

3. If there is a “DependOnService” value, simply modify it and add the service you want to start before the one you are editing in the registry.

If no “DependOnService” value exists create one:
Right click service name -> New -> Multi-string value
Enter the name DependOnService then modify this new record and add the service you want to start before the one you are editing.

To verify you have the right service name to enter open up Services, right click the service in question, and choose properties. Use the Service name and not the Display name. For instance the IIS Admin Service name is “IISADMIN”.

4. The server will require a restart to apply the change. Once restarted you can open Services, right click the service you edited, choose properties, then the Dependencies tab and you will see the change.

Read More →

VS2012 Schema compare buttons disabled

Visual Studio 2013

November 15, 2013 | Posted in Visual Studio 2012

There have been many trials and tribulations during the upgrade process from Visual Studio 2010 to Visual Studio 2012, not least the SQL Schema Compare functionality.

Having done the initial upgrade between the previous to the new version of Visual Studio, all .dbproj files were converted over to the new .sqlproj format. If you have written any SQL CLR projects in Visual Studio 2010 i.e. .csproj format, these too will get converted to .sqlproj files.

The first thing you will realize is that the references from your new .sqlproj file will throw syntax errors saying that your schema objects i.e. sprocs/functions etc can no longer resolve your CLR proj references. To get around this, go to properties on the reference too your CLR proj file, and change property “Model Aware” to True, this will allow you to compile again successfully.

The new way of doing a schema compare is to create a schema compare file. From with the VS IDE, go to SQL -> Schema Compare -> New Schema Compare. It’s important to note that the settings regarding which types to ignore are now held in this .scmp file. Once you’ve been through the settings and configured it to your liking, check this file in to TFS so that you can reuse it, otherwise you’ll end up having to go through these settings time and time again.

If you try and compare your new .sqlproj file to a SQL Server database, you’ll notice that the two “Update” and “Generate Script” buttons are disabled.

VS2012 Schema compare buttons disabled

Through a lot of digging, I eventually found that the reason for this is that under your .sqlproj settings, you need to set a “Default” value on any “SQLCMD Variables” you may have included (this is the name of the option on the left hand side). Having done this, the options should become available (note you may need to restart the solution).

sqlcmd_variables

The behaviour of these SQLCMD Variables seems to be that it copies the values to your .sqlproj.user file, which the schema compare relies on. If you do not set a default value, you won’t be able to do a compare and generate scripts. The value you provide in the “Default” value will be stored in the project file and can be checked in to source control, however the “Local” value is specific to your machine which gets stored in your .sqlproj.user file I mentioned previously (which is not under source control). If you leave the Local value blank, the Default value will be used.

If this helped solve your issue, leave a comment and let me know.

Read More →