blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

SSIS Junkie

VSTS4DBP: How do I change the name of the output .sql file?

When you build a datadude project the output is a .sql file that contains the name of the project, the name of the target server, and the name of the database. We (Andy and I) came across a problem where the name of the output file was too long for MSBuild, which is being used by our TFS builds to build .msi installers for our databases. Unfortunately there is no way to change the name of the output file from within Visual Studio.

Well thanks to help here from J.D. Laflen and Katrina (surname unknown) from the datadude dev team, we came up with a workaround.

 

Firstly, you can change the name of the output file by specifying it in the BuildScriptName property on the command-line call to msbuild. Witness:

>msbuild UpstreamSolutions.SqlServer.SJVCommonReference.dbproj /t:Build
/p:BuildScriptName=MyTest.sql
Microsoft (R) Build Engine Version 2.0.50727.42
[Microsoft .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation 2005. All rights reserved.

Build started 12/11/2006 10:31:03 AM.
__________________________________________________
Project "C:\TFSProjects\Minerva\src\Solutions\UpstreamSolutions.
SqlServer.SJVCommonReference\UpstreamSolutions.SqlServer.SJVCommonRefere
nce.dbproj" (Build target(s)):

Target SqlBuild:
    Building deployment script for SJVCommonReference : AlwaysCreateNewDatabase,
 EnableFullTextSearch, BlockIncrementalDeploymentIfDataLoss

    UpstreamSolutions.SqlServer.SJVCommonReference --> file:///C:/TFSPro
jects/Minerva/src/Solutions/UpstreamSolutions.SqlServer.SJVCommo
nReference/sql/MyTest.sql
Done building target "SqlBuild" in project "UpstreamSolutions.SqlServer.
SJVCommonReference.dbproj".

Done building project "UpstreamSolutions.SqlServer.SJVCommonReference.db
proj".

Build succeeded.

    0 Warning(s)
    0 Error(s)

Time Elapsed 00:01:04.45

Buried in all that lot you can see that the output file is called MyTest.sql.

 

That doesn't solve the problem of us not being able to set it when you do a build from Visual Studio though. Well there is a hack you can do to get around that. You need to add a new <PropertyGroup> element to the project (.dbproj) file like so:

<!-- Import the settings  -->
  <Import Project="$(MSBuildBinPath)\Microsoft.VisualStudio.TeamSystem.Data.Tasks.targets" />
- <PropertyGroup Condition="'$(Configuration)' == 'Default'">
     <BuildScriptName>MyTest.sql</BuildScriptName>
  </PropertyGroup>

Now, whenever you build from Visual Studio the name of the output file can be whatever you want it to be rather than the unweildy default name.

I've requested that the name of the output can be set from within Visual Studio. If you think that would be a worthy change to have put into datadude V2 then go here and vote for it.

-Jamie

 

 

 

Published 11 December 2006 18:49 by jamie.thomson

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

SSIS Junkie said:

As Gert Drapers has previously reported , the datadude team have released Service Release 1 (SR1) and

August 13, 2007 22:56

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication

News

Powered by Community Server (Personal Edition), by Telligent Systems