Question

I am using a custom build process template and I am trying to declare a variable that can be used to populate the default in an argument, but I'm having some problems and I think it's simply because I don't quite understand how XAML and the build process use variables.

For ease of explanation (because our build process is terribly complex) here is what I'm looking at:

Process Begin
    Run On Agent
    Initialize Variables
        If RunTests = True Then
            Establish a Connection to SQL
            Run SQL
            Run Tests
            Email User with Results
        Else
            <Do Other Things>
        End If
    Finish Build
Process End

I'm trying to use the XAML editor built in to VS2012 (although I'm open to switching if there's a better IDE, I have to add a lot of stuff to this template). So I'll click on the Run On Agent node and click on the Variables section to create a variable called SQLServername. This variable is supposed to be populated by the SqlServerHostName argument that is part of the Build Definition. So SQLServername's default value is SqlServerHostName. No problem there, I think.

However, I then try to add a new argument: ConnectionString which defaults to "Server=" & SQLServername & ";database=master;integrated security=sspi", and the compiler error:

SQLServername is not declared

Occurs. I'm sure I am misunderstanding variables and how they're used within this thing, but what should I be looking for?

Was it helpful?

Solution

It turns out that I was misunderstanding the scope of the variable declaration. I simply left the ConnectionString as a string that the user can modify, which works for our purposes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top