Welcome to MSDN Blogs Sign in | Join | Help

Ben Moore's Blog

Random stuff from an Application Development Consultant, Microsoft UK

News

  • DISCLAIMER: All information on this blog is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified here
“Please wait while the installer finishes determining your disk requirements”

That’s rather annoying message that I kept getting today while trying to install an MSI into a VM.  A quick Bing search showed a few people with this issue, most stating that you need to run the msi from the command line using MSIEXEC to work around the issue.

A slightly easier one – that worked for me at least – was simply to restart the Windows Installer service.  Once this was done the MSI installed fine.

Visual Studio Team Database – Properties List

VSDB provides a number of configuration properties that can be used during deployment.  These options are found in the Database.sqldeployment file that is included in your database project:

image

image

These options can also be specified on the command line when using the VSDBCMD tool, using the following syntax:

VSDBCMD /a:Deploy /cs:"connectionstring" /dsp:Sql /model:ProjectName.dbschema
/p:TargetDatabase=targetDB /manifest:manifestFileName.dbmanifest /script:outputScriptFileName.sql
/p:PropertyName=PropertyValue

The following table lists all the options available along with descriptions and default values:

Option Description Default Value
/p:AbortOnFirstError Generate the deployment script to break on first error ON
/p:AlwaysCreateNewDatabase Generate the deployment script to always create a new database (and drop one with the same name if it already exists on the target)  
/p:AnsiNulls Override to explicitly set the AnsiNulls connection setting. This is sometimes needed to correctly create the objects in your model  
/p:AnsiPadding Override to explicitly set the AnsiPadding connection setting. This is sometimes needed to correctly create the objects in your model  
/p:AnsiWarnings Override to explicitly set the AnsiWarnings connection setting. This is sometimes needed to correctly create the objects in your model  
/p:ArithAbort Override to explicitly set the ArithAbort connection setting. This is sometimes needed to correctly create the objects in your model  
/p:BlockIncrementalDeploymentIfDataLoss Emit script to verify if there is potential data loss due to actions in the script.  
/p:CommentOutSetVarDeclarations Comment out the :setvar block at the top of the deployment script. This is useful if the script will be executed with another tool like SqlCmd.exe  
/p:ConcatNullYieldsNull Override to explicitly set the ConcatNullYieldsNull connection setting. This is sometimes needed to correctly create the objects in your model  
/p:DeployDatabaseProperties Specifies whether or not scripts to database-level properties should be generated when differences are detected.  
/p:DeploymentCollationPreference This option specifies which database collation should be used when generating the script. For consistency’s sake, this should be left to its default which is to use the source model’s collation since that is the collation used when the model was tested and verified.  
/p:DeploymentConfigurationFile The deployment configuration file to use.  
/p:DisableAndReenableDdlTriggers Generate scripts that disable any database triggers prior to execution and then re-enable the triggers after deployment has been completed. ON
/p:DoNotUseAlterAssemblyStatementsToUpdateCLRTypes If set to true, the deployment script will always drop and recreate an assembly and its objects if difference are detected  
/p:EnforceMinimalDependencies If this option is set to true it might result in a faster deployment if your database has many large stored procedures, but the stored procedures in the deployment script could be incorrectly ordered.  
/p:GenerateDeployStateChecks Generate TSql statements to verify that the instance and database used to generate the script are the same as the ones the script is currently being executed against. It was a common request to expose a way to turn these state requests off ON
/p:GenerateDropsIfNotInProject Drop objects in the target that are not in the source model.  
/p:IgnoreAnsiNulls Ignore AnsiNull settings when comparing two objects.  
/p:IgnoreAuthorizer Ignore an object’s Authorizer when comparing two objects  
/p:IgnoreAutoGeneratedNames Auto generated names are always ignored  
/p:IgnoreBodyDependencies Controls whether analyzed dependencies are used when determining whether two objects are the same. Since object scripts are also compared this option should be left to true ON
/p:IgnoreCollations Collations specified on objects other than columns are never ignored  
/p:IgnoreColumnCollation Controls whether the column collation differences should be ignored  
/p:IgnoreComments Ignore comment differences when comparing script bodies.  
/p:IgnoreDdlTriggerState Ignore DDL trigger state differences when comparing two DDL triggers  
/p:IgnoreDefaultSchema Ignore default schema differences  
/p:IgnoreDmlTriggerOrder Ignore DML trigger order differences  
/p:IgnoreDmlTriggerState Ignore DML trigger state differences  
/p:IgnoreExtendedProperties Ignore and exclude extended properties from deployment  
/p:IgnoreFileAndLogFilePath Ignore path differences, these almost always should be ignored due to machine differences. Vsdbcmd will not generate a script to modify the path  
/p:IgnoreFilegroupPlacement Ignore file group differences for tables and indexes ON
/p:IgnoreFileSize Ignore size differences – they will always be different if you have data ON
/p:IgnoreFillFactor Ignore the fill factor on indexes ON
/p:IgnoreFullTextCatalogFilePath Ignore path differences  
/p:IgnoreIdentitySeed Ignore seed differences  
/p:IgnoreIncrement Ignore increment differences  
/p:IgnoreIndexOptions Ignore other index option differences like row and page locks  
/p:IgnoreIndexPadding Ignore padding differences ON
/p:IgnoreKeywordCasing Ignore keyword casing like FROM <-> from. ON
/p:IgnoreLockHintsOnIndexes Ignore other index option differences like row and page locks  
/p:IgnoreLoginSids Ignore SID differences where the names of the logins are the same  
/p:IgnoreObjectPlacementOnPartitionScheme Ignore partition scheme differences ON
/p:IgnorePasswords Ignore password differences ON
/p:IgnorePermissions Ignore all SQL permission statements  
/p:IgnoreQueueEventNotifications Event notifications are never ignored  
/p:IgnoreQuotedIdentifiers Ignore quoted identifiers setting differences  
/p:IgnoreRoleMembership Role memberships are never ignored  
/p:IgnoreSemicolonBetweenStatements Ignore semicolon differences when comparing script bodies  
/p:IgnoreStatisticsSample Ignore sample size and style differences  
/p:IgnoreTableOptions Ignores sp_table option differences on tables  
/p:IgnoreUserSettingsObjects Ignores all option differences for a user as well as its login and default schema  
/p:IgnoreWhitespace Ignore whitespace when comparing script bodies ON
/p:IgnoreWithNocheckOnCheckConstraints Ignores differences between a check constraint enabled state  
/p:IgnoreWithNocheckOnForeignKeys Ignores differences between a foreign key’s enabled state  
/p:IncludeTransactionalScripts Generate a transactional deployment script. Some statements cannot be executed within a transaction, these will be executed before or after the transaction.  
/p:NumericRoundAbort Override to explicitly set the NumericRoundAbort connection setting. This is sometimes needed to correctly create the objects in your model  
/p:PerformDatabaseBackup Backup the database before executing the deployment script. The database will be backed up even if the database is being recreated.  
/p:QuotedIdentifier Override to explicitly set the QuotedIdentier connection setting. This is sometimes needed to correctly create the objects in your model  
/p:SingleUserMode Set the database in single user mode while updating  
/p:SqlCommandVariablesFile The SqlCmd variables file that contains name value pairs representing Sql Command variables and values defined in the deployment script.  
/p:TargetDatabase:(string) The name of the target database  
/p:TreatVerificationErrorsAsWarnings Plan verification is a new feature that verifies the deployment plan prior to generating the deployment script or executing. Plan verification can generate errors that will block deployment. This option will cause all errors to be generated as warnings even though the script itself might fail when executed.  
/p:UnmodifiableObjectWarnings Controls whether warnings are generated for objects that are different but no script is generated to update them. An example is file path differences. ON
/p:VerifyDeployment Controls whether to verify the deployment plan prior to generating the deployment script. ON

Note – this list is based on the version 2 of the Database Edition GDR, which have be downloaded from here.

For more information on VSDBCMD see here.

C# - to var or not to var?

After a discussion about ReSharper with yet another colleague the other day, I decided that it was finally time I installed the trial and gave it a go.  After all, it's only on version 4 already :)

I've un-installed it after only a day or so, I won't go into that right now, but during the time I had it installed it kept prompting me to change the way I declared variables.  Every time I declared a variable like this

string myValue = "Hello";

I would get a prompt suggesting I replaced the declaration with

var myValue = "Hello";

This prompt appeared for any local variable declarations, but I find myself questioning whether this is good coding practice or not.  I understand the benefits of the var keyword and in certain scenarios, such as when using LINQ or anything else that uses anonymous types, it is an extremely powerful tool to have at your disposal.  However, in plain old coding, surely you want to be explicit about what you are declaring?  The two expressions may well get compiled down to the same code, but in a world where code readability and maintainability rank highly on the priority list then I personally like being able to see at a glance what types I'm dealing with.

Just my 2p...

Using environment variables to set web test context

While investigating ways to control parameterised web servers in Visual Studio web tests yesterday I found out that you can use environment variables to set the values of context parameters within your test.  If you have a context parameter called, for example, 'WebServer1' (original I know), then you can use an environment variable called 'Test.WebServer1' to pass a value in to the test.  This is of course not limited to web server names and can be used where appropriate for any other environment specific context values by specifying an environment variable of the format 'Test.ContextParameterName'.

This problem can also be addressed using data binding or test plug-ins, depending on your requirements.

The use of environment variables for this scenario is mentioned in a note on the following MSDN page.

 

Hello World

Ok, so it's not exactly an original title for a first post on a technical blog, but I felt it had to be done...

You can find out a little about me and what I do here.  My aim for this blog is to provide useful technical information based on the work I do at Microsoft and the challenges and problems that I see customers facing. 

I can't promise to be the most frequent poster, but hopefully someone will benefit from what I post on here :)

 

Page view tracker