question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Visual Studio Build step should allow multiple paths

See original GitHub issue

Right now the VSBuild tasks allows you to specify either one SLN file (relative) path or a wildcard. That doesn’t work for our team projects because we typically have two or three SLNs out of >10 that we build on a regular basis. So I really, really want to not have to duplicate VS Build steps to handle this. After looking at the VSBuild.ps1 1.0.16 version, I modified it pretty simply to support this. I replaced this:

# check for solution pattern
if ($solution.Contains("*") -or $solution.Contains("?"))
{
    Write-Verbose "Pattern found in solution parameter."
    Write-Verbose "Find-Files -SearchPattern $solution"
    $solutionFiles += Find-Files -SearchPattern $solution
    Write-Verbose "solutionFiles = $solutionFiles"
}
else
{
    Write-Verbose "No Pattern found in solution parameter."
    $solutionFiles = ,$solution
}

with this:

$solutionFiles = @()
foreach ($sln in ($solution -split '\|').Trim()) {
    # check for solution pattern
    if ($solution.Contains("*") -or $solution.Contains("?"))
    {
        Write-Verbose "Pattern found in solution parameter."
        Write-Verbose "Find-Files -SearchPattern $solution"
        $solutionFiles += Find-Files -SearchPattern $solution
        Write-Verbose "solutionFiles = $solutionFiles"
    }
    else
    {
        Write-Verbose "Solution path found in solution parameter."
        if (!([System.IO.Path]::IsPathRooted($sln))) {
            $sln = Join-Path $env:BUILD_SOURCESDIRECTORY $sln
        }
        $solutionFiles += $sln
    }
}

This allows me to specify multiple SLN paths like so:

Foo.sln | Samples\Samples.sln

I chose the | character as a separator as that is not a valid path char and does not interfere with wildcard paths. In fact, this change would allow for mixed combination of SLN paths and wildcard specs e.g.:

Foo.sln | Samples\**\*.sln

So I was thinking about contributing this back as a PR but I see that the VSBuild.ps1 script has been updated to use Get-SolutionFiles from the module $PSScriptRoot\ps_modules\MSBuildHelpers\MSBuildHelpers.psm1 which I can’t find.

Is this something you might be interested in taking as a PR? If so, where can I find this mysterious MSBuildHelpers.psm1 module file?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
rkeithhillcommented, Aug 24, 2016

Why? You realize we had this capability in the XAML based build process parameters, right? Accepting a wildcard is already acknowledgement that the build step will build multiple solutions. I fail so see why specifying multiple paths vs a wildcard should make a difference? I just want to avoid unnecessary duplication in build step configuration (parameters, configuration, etc).

As it stands, we already have too much VS step duplication because we can’t use the “multiple configuration” feature since it applies to every step and that doesn’t work for 90% of our builds. We have build steps that package up results from multiple configurations (all combos of x86, x64, debug and release) and frankly we only need to build docs, nuget pkgs and MSI installers once - period. Not once per configuration.

3reactions
bryanmacfarlanecommented, Aug 23, 2016

It’s designed to take a path even though wildcards can be in that single path spec. We won’t support multiple paths - that’s multiple tasks in the job.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to: Build multiple configurations - Visual Studio (Windows)
To build a project in multiple build configurations · On the menu bar, choose Build > Batch Build. · In the Build column,...
Read more >
Multiple Output paths for a C# Project file - Stack Overflow
You have a section build events in your project's properties. You can use post-build events to copy your output to different locations.
Read more >
Debugging in Visual Studio Code
One of the great things in Visual Studio Code is debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >
Creating an extension using only Visual Studio
%~3 is the path to the build folder given by the third argument. This is by default set to "..\..\Build\bin\AnyCPU\Debug\", in the example...
Read more >
InspectCode Command-Line Tool - ReSharper - JetBrains
In most cases, it is recommended to leave the default behavior or use the --build option because even if your CI chain already...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found