|
140 | 140 | New-SSRSFolder -Proxy $Proxy -Name $DataSetFolder |
141 | 141 |
|
142 | 142 | $DataSourcePaths = @{} |
143 | | - $Project.SelectNodes('Project/DataSources/ProjectItem') | |
144 | | - ForEach-Object { |
145 | | - $RdsPath = $ProjectRoot | Join-Path -ChildPath $_.FullPath |
| 143 | + for($i = 0; $i -lt $Project.Project.ItemGroup[0].DataSource.Count; $i++) { |
| 144 | + $RdsPath = $ProjectRoot | Join-Path -ChildPath $Project.Project.ItemGroup[0].DataSource[$i].Include |
146 | 145 |
|
147 | | - $DataSource = New-SSRSDataSource -Proxy $Proxy -RdsPath $RdsPath -Folder $DataSourceFolder -Overwrite $OverwriteDataSources |
148 | | - $DataSourcePaths.Add($DataSource.Name, $DataSource.Path) |
149 | | - } |
| 146 | + $DataSource = New-SSRSDataSource -Proxy $Proxy -RdsPath $RdsPath -Folder $DataSourceFolder -Overwrite $OverwriteDataSources |
| 147 | + $DataSourcePaths.Add($DataSource.Name, $DataSource.Path) |
| 148 | + } |
150 | 149 |
|
151 | 150 | $DataSetPaths = @{} |
152 | 151 | $Project.SelectNodes('Project/DataSets/ProjectItem') | |
|
159 | 158 | } |
160 | 159 | } |
161 | 160 |
|
162 | | - $Project.SelectNodes('Project/Reports/ResourceProjectItem') | |
163 | | - ForEach-Object { |
164 | | - if($_.MimeType.StartsWith('image/')) |
165 | | - { |
| 161 | + for($i = 0; $i -lt $Project.Project.ItemGroup[1].Report.Count; $i++) { |
166 | 162 |
|
167 | | - $Path = $ProjectRoot | Join-Path -ChildPath $_.FullPath |
168 | | - $RawDefinition = Get-Content -Encoding Byte -Path $Path |
| 163 | + $extension = $Project.Project.ItemGroup[1].Report[$i].Include.Substring($Project.Project.ItemGroup[1].Report[$i].Include.length - 3 , 3) |
| 164 | + |
| 165 | + if(ImageExtensionValid -ext $extension){ |
| 166 | + |
| 167 | + $PathImage = $ProjectRoot | Join-Path -ChildPath $Project.Project.ItemGroup[1].Report[$i].Include |
| 168 | + $RawDefinition = Get-Content -Encoding Byte -Path $PathImage |
169 | 169 |
|
170 | 170 | $DescProp = New-Object -TypeName SSRS.ReportingService2010.Property |
171 | 171 | $DescProp.Name = 'Description' |
|
175 | 175 | $HiddenProp.Value = 'false' |
176 | 176 | $MimeProp = New-Object -TypeName SSRS.ReportingService2010.Property |
177 | 177 | $MimeProp.Name = 'MimeType' |
178 | | - $MimeProp.Value = $_.MimeType |
| 178 | + $MimeProp.Value = 'image/' + $extension |
179 | 179 |
|
180 | 180 | $Properties = @($DescProp, $HiddenProp, $MimeProp) |
181 | 181 |
|
182 | | - if($_.FullPath.StartsWith('_')) |
183 | | - { |
184 | | - $HiddenProp.Value = 'true' |
185 | | - } |
186 | | - |
187 | | - $Name = $_.FullPath |
| 182 | + $Name = $Project.Project.ItemGroup[1].Report[$i].Include |
188 | 183 | Write-Verbose "Creating resource $Name" |
189 | 184 | $warnings = $null |
190 | | - $Results = $Proxy.CreateCatalogItem("Resource", $_.FullPath, $Folder, $true, $RawDefinition, $Properties, [ref]$warnings) |
| 185 | + $Results = $Proxy.CreateCatalogItem("Resource", $Project.Project.ItemGroup[1].Report[$i].Include, $Folder, $true, $RawDefinition, $Properties, [ref]$warnings) |
191 | 186 | } |
192 | 187 | } |
193 | 188 |
|
194 | | - $Project.SelectNodes('Project/Reports/ProjectItem') | |
195 | | - ForEach-Object { |
196 | | - $CompiledRdlPath = $ProjectRoot | Join-Path -ChildPath $OutputPath | join-path -ChildPath $_.FullPath |
197 | | - New-SSRSReport -Proxy $Proxy -RdlPath $CompiledRdlPath |
198 | | - } |
| 189 | + for($i = 0; $i -lt $Project.Project.ItemGroup[1].Report.Count; $i++) { |
| 190 | + if($Project.Project.ItemGroup[1].Report[$i].Include.EndsWith('.rdl')){ |
| 191 | + $CompiledRdlPath = $ProjectRoot | Join-Path -ChildPath $OutputPath | join-path -ChildPath $Project.Project.ItemGroup[1].Report[$i].Include |
| 192 | + New-SSRSReport -Proxy $Proxy -RdlPath $CompiledRdlPath -RdlName $Project.Project.ItemGroup[1].Report[$i].Include |
| 193 | + } |
| 194 | + } |
| 195 | + |
| 196 | + Write-host "Completed." |
| 197 | +} |
| 198 | + |
| 199 | +function ImageExtensionValid($ext){ |
| 200 | + $valid = 0; |
| 201 | + |
| 202 | + Switch($ext) |
| 203 | + { |
| 204 | + 'png' { $valid = 1; } |
| 205 | + 'bmp' { $valid = 1; } |
| 206 | + 'gif' { $valid = 1; } |
| 207 | + 'jpg' { $valid = 1; } |
| 208 | + } |
199 | 209 |
|
200 | | - Write-Verbose "Completed." |
| 210 | + return $valid; |
201 | 211 | } |
0 commit comments