<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>DataDude Annoyance #13: Project variables omitted from output script.</title><link>http://blogs.msdn.com/reedme/archive/2007/12/06/datadude-annoyance-13-project-variables-omitted-from-output-script.aspx</link><description>If you're using any software product for a non-trivial purpose, you'll find that it has flaws that will (upon occasion) drive you up a wall. It doesn't make any difference what it is or who produced it. I've even heard Mac users, upon occasion, complain</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>VSTS Links - 12/10/2007</title><link>http://blogs.msdn.com/reedme/archive/2007/12/06/datadude-annoyance-13-project-variables-omitted-from-output-script.aspx#6722813</link><pubDate>Mon, 10 Dec 2007 15:14:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6722813</guid><dc:creator>Team System News</dc:creator><description>&lt;p&gt;The NWCandence blog on Branching Strategies. MRod on tfs workspaces and reinstalling the OS or Team Explorer....&lt;/p&gt;</description></item><item><title>re: DataDude Annoyance #13: Project variables omitted from output script.</title><link>http://blogs.msdn.com/reedme/archive/2007/12/06/datadude-annoyance-13-project-variables-omitted-from-output-script.aspx#8089830</link><pubDate>Fri, 07 Mar 2008 10:29:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8089830</guid><dc:creator>Patrick Neborg</dc:creator><description>&lt;p&gt;When I tried this approach under TFSBuild, it locked up on me. Probably because that directory structures are completely under a TFSBuild scenario compared to IDE Build. So I adapted this solution slighty. I removed using a post build event to execute the vbs script. And in the TFSBuild.Proj file I added an after compile copy &amp;amp; exec task. Excerpt of the edit to TFSBuild.Proj shown here (not my solution is under \database\CMS\CMS below TFS build's solution root):&lt;/p&gt;
&lt;p&gt;....&lt;/p&gt;
&lt;p&gt; &amp;lt;Target Name=&amp;quot;AfterCompile&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;&amp;lt;Copy SourceFiles=&amp;quot;$(SolutionRoot)\Database\CMS\CMS\post_build.vbs&amp;quot; DestinationFolder=&amp;quot;$(OutDir)&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;&amp;lt;Exec WorkingDirectory=&amp;quot;$(OutDir)&amp;quot; Command=&amp;quot;&amp;amp;quot;$(OutDir)post_build.vbs&amp;amp;quot;&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;/Target&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/Project&amp;gt;&lt;/p&gt;</description></item><item><title>re: DataDude Annoyance #13: Project variables omitted from output script.</title><link>http://blogs.msdn.com/reedme/archive/2007/12/06/datadude-annoyance-13-project-variables-omitted-from-output-script.aspx#8089919</link><pubDate>Fri, 07 Mar 2008 10:32:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8089919</guid><dc:creator>Patrick Neborg</dc:creator><description>&lt;p&gt;I also rewrote the vbs script for better performance. This version does not concatenate the .sql file into a string variable. Instead it temporarily renames the .sql file and creates a new empty .sql file. As it read line by line it also writes to the newly created empty .sql. At the correct spot it writes in the variable lines. And then finishes writing the remainder of the file. In the end it cleans up the .tmp file. &lt;/p&gt;
&lt;p&gt;On Error Resume Next&lt;/p&gt;
&lt;p&gt;Dim fso, ts, line, x, y, script, variables, filepath&lt;/p&gt;
&lt;p&gt;Const ForReading = 1, ForWriting = 2, ForAppending = 8&lt;/p&gt;
&lt;p&gt;' NOTE: This name must match the DataDude &amp;quot;Build Output File Name&amp;quot; &lt;/p&gt;
&lt;p&gt;' in project properties.&lt;/p&gt;
&lt;p&gt;filepath = &amp;quot;CMS.(local).CMS.sql&amp;quot;&lt;/p&gt;
&lt;p&gt;filepath_Orig = filepath + &amp;quot;.tmp&amp;quot;&lt;/p&gt;
&lt;p&gt;' Append your additional variables here, one per line. &lt;/p&gt;
&lt;p&gt;' Include blank lines as desired for spacing.&lt;/p&gt;
&lt;p&gt;variables = Array( _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;quot;&amp;quot; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;,&amp;quot;-- Additional variables added by Post_Build.vbs&amp;quot; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;,&amp;quot;:setvar STR_DB &amp;quot;&amp;quot;STR&amp;quot;&amp;quot;&amp;quot;)&lt;/p&gt;
&lt;p&gt;Set fso = CreateObject(&amp;quot;Scripting.FileSystemObject&amp;quot;)&lt;/p&gt;
&lt;p&gt;'rename file with .tmp&lt;/p&gt;
&lt;p&gt;if fso.FileExists(filepath_Orig) then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; fso.DeleteFile filepath_Orig,True&lt;/p&gt;
&lt;p&gt;end if&lt;/p&gt;
&lt;p&gt;if fso.FileExists(filepath) then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fso.MoveFile filepath , filepath_Orig&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fso.CreateTextFile filepath,true&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'read one file and write to the other file&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set ts = fso.OpenTextFile(filepath_Orig, ForReading)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set ts2 = fso.OpenTextFile(filepath, ForWriting)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x = 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Do Until ts.AtEndOfStream&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;line = ts.ReadLine&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ts2.writeline(line)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x = x + 1&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If x = 7 Then ' Right after the last existing :setvar.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;' Append variable definitions.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For Each line In variables&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ts2.writeline(line &amp;amp; vbCrLf)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'script = script &amp;amp; line &amp;amp; vbCrLf&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Loop&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ts.Close&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ts2.Close&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'Set ts = fso.OpenTextFile(filepath, ForWriting)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'ts.Write(script)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'ts.Close&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set ts = Nothing&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set ts2 = Nothing&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fso.DeleteFile filepath_Orig&lt;/p&gt;
&lt;p&gt;else&lt;/p&gt;
&lt;p&gt;fso.CreateTextFile &amp;quot;post_build_output.text&amp;quot;&lt;/p&gt;
&lt;p&gt;Set ts2 = fso.OpenTextFile(&amp;quot;post_build_output.text&amp;quot;, ForWriting)&lt;/p&gt;
&lt;p&gt; ts2.writeline (&amp;quot;Could not find &amp;quot; + filepath)&lt;/p&gt;
&lt;p&gt;end if&lt;/p&gt;
&lt;p&gt;Set fso = Nothing&lt;/p&gt;</description></item></channel></rss>