Blank first line when creating a .txt file

Hi FinalBuilder people,

I continue to love what you do, but...... I have a problem.

I have a project which defines a file set named Projects which is recursively looking for any files that are of type *.vbproj or *.csproj from a root directory.

After getting latest from our source control it uses the fileSet Log files action list on the Projects fileSet with an output monitor that saves all matches to a variable %projectList%. The output monitor has a search string of *.* with the 'uses wildcards' checkbox selected.

The project then creates a text file named DNNProjectsList.txt containing the variable %projectsList%.

I want to iterate through the DNNProjectsList.txt file and compile all the projects.

The problem I'm having is that the first line of the DNNProjectsList.txt file is always blank and will therefore attempt to compile a blank project when its in the iterator, and as a result will fail.

Has anyone else had this problem? More importantly is there an easy solution?

Hopefully I have made sense.

Cameron

 

Hi Cameron,

Thanks for your post. Sorry to hear you're having problems.

Can you isolate whether it's the output monitor or the Write to Text File action which is adding the blank line? A "Log Variable Values" action should help you determine this quickly. If there is a bug in either action, we'll make sure to fix it.

Incidentally, if you just want to save the entire contents of the action output to a variable, you don't need to use an output monitor : you can just use "Log to Variable" under the "Logging Properties" from the action. Also, there's a "FileSet to Variable" action which will automatically save the contents of the FileSet to a variable in a single action.

A temporary workaround for the bug would be to put a "If %ProjectName% <> " action as the first child of the File Contents Iterator, and place all the other actions as a child of the If..Then.

Another workaround would be to use a List Iterator to iterate the variable contents, instead of a File Contents Iterator.


Regards,

Angus

Thanks very much for the suggestions. Firstly I have tried to isolate the problem.

When using the 'Log to Variable' action just after I have used the output monitor on the action 'fileset Log files' and saving to the variable %ProjectList%, i get this output:

Current variable values :
ProjectList =
D:\Projects\.......\MembershipProvider.vbproj
D:\Projects\.......\HIL.Common.vbproj
D:\Projects\........\HILChangePassword.vbproj

and so forth.

To be specific in the output monitor  the Search String = '*.*proj'

Use Wildcards is checked on.

Behaviour = 'Save all matches'

Variable = ProjectList

The blank line is definitely being created when using the output monitor, I'm not saying its a bug but it isn't working the way i was intending it to work.

When using 'Logging Properties' instead of 'Output Monitor' and log to the variable %ProjectList% I get unwanted extra values such as 'Using FileSet: Projects' and 'Logged 26 files' as seen below:

Current variable values :
ProjectList = Using FileSet: Projects
D:\Projects\.......\MembershipProvider.vbproj
D:\Projects\.......\HIL.Common.vbproj
D:\Projects\.......\HILChangePassword.vbproj
.............

Logged 26 files

I wanted to restrict what was put into the vairable %ProjectsList% which is why i used output monitor and the search string *.*proj

In saying all that, the 'FileSet to Variable' action works exactly the way i needed it to. So there's my problem solved. Thanks heaps for the help guys. Sorry for the big post, but i thought too much information may be better than not enough for anyone who may read these posts.

Cameron

 

Hi Cameron,

Thanks for the extremely detailed response. You are right that the bug was in the “Save All Matches to Variable” feature of the output monitor - it was inserting a leading newline.

We’ll have a test build with the fix available today, but it doesn’t sound like you need it for now anyhow.

Please let us know if there’s anything else we can help with. :-).

- Angus

Just as an additional comment about my slow progression.

I'm now using the file/fileset Iterator action which further simplifies my project with less variables and no need to create .txt files and so forth.

Cam

Excellent. :). With FinalBuilder there are often infinite possible ways to solve a given problem. Sometimes it takes a while to find the quickest/simplest solution.