mmajcica / DeploySsrs

Build-Release task for VSTS/TFS that manages Microsoft's SQL Server Reporting Services
MIT License
21 stars 21 forks source link

Wildcard for reports in configuration file #31

Closed BilThomas closed 4 years ago

BilThomas commented 5 years ago

Is there are way to write the configuration file so that it can deploy multiple/all reports ao a specific folder without listing each report file by name or do you have to customize the build/release process each time a developer adds a report?

mmajcica commented 5 years ago

It is not supported such an approach as all of the reports are coming from a flat source, so no indication on the source is possible. In the way the tool is set at this stage, it is not possible to add such a functionality easily. However, this may be a good addition features wise, but we will need to agree on proper design and make a larger refactoring (and testing). I could assist in what concerns the design, but I have no time at this moment to tackle such change. You for sure are welcome to give it a try.

I'll le this issue open and ark it as a feature request.

paco6381 commented 4 years ago

I just wanted to share my workaround here, in case it is useful to anyone else. (And, it may be able to be incorporated into the task to add this feature)

I created a powershell script to look at a folder structure (output from visual studio) and generate a very basic SSRS config file in json. So, basically, whatever the folder structure that Visual Studio outputs, you can use this powershell to generate a config file to use for input to this task.

param([String]$sourceFolder="", [String]$outputFile="")

$folders = 
    Get-ChildItem -Path $sourceFolder -Filter '*.rdl' -Recurse |
    Where-Object {$_.FullName.Contains('bin')} |
    Group-Object -Property {$_.Directory.FullName.Replace($sourceFolder, '') -replace '\\bin\\.*', ''} |
    Where-Object {$_.Count -gt 0} |
    Foreach-Object {
        [pscustomobject]@{
            Name = $_.Values[0].Replace($sourceFolder, '');
            Reports = $_.Group | 
                Foreach-Object {
                    [pscustomobject]@{
                        Name = $_.Name.Replace('.rdl', '');
                        FileName = $_.FullName.Replace($sourceFolder, '');
                    };
                }
        }
    }

$root = [pscustomobject]@{
    Name = 'Root';
    Folders = $folders;
}

ConvertTo-Json $root -Depth 5 | Out-File -FilePath $outputFile
horoxix commented 4 years ago

I just wanted to share my workaround here, in case it is useful to anyone else. (And, it may be able to be incorporated into the task to add this feature)

I created a powershell script to look at a folder structure (output from visual studio) and generate a very basic SSRS config file in json. So, basically, whatever the folder structure that Visual Studio outputs, you can use this powershell to generate a config file to use for input to this task.

param([String]$sourceFolder="", [String]$outputFile="")

$folders = 
    Get-ChildItem -Path $sourceFolder -Filter '*.rdl' -Recurse |
    Where-Object {$_.FullName.Contains('bin')} |
    Group-Object -Property {$_.Directory.FullName.Replace($sourceFolder, '') -replace '\\bin\\.*', ''} |
    Where-Object {$_.Count -gt 0} |
    Foreach-Object {
        [pscustomobject]@{
            Name = $_.Values[0].Replace($sourceFolder, '');
            Reports = $_.Group | 
                Foreach-Object {
                    [pscustomobject]@{
                        Name = $_.Name.Replace('.rdl', '');
                        FileName = $_.FullName.Replace($sourceFolder, '');
                    };
                }
        }
    }

$root = [pscustomobject]@{
    Name = 'Root';
    Folders = $folders;
}

ConvertTo-Json $root -Depth 5 | Out-File -FilePath $outputFile

Thank you so much for this!

mmajcica commented 4 years ago

Duplicate. Refer to issues #7 for more details.