139139 New-SSRSFolder - Proxy $Proxy - Name $DataSourceFolder
140140 New-SSRSFolder - Proxy $Proxy - Name $DataSetFolder
141141
142+ $DataSourceItemGroup = $Project.Project.ItemGroup | Where-Object { $_.FirstChild.LocalName -eq ' DataSource' }
142143 $DataSourcePaths = @ {}
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
144+ for ($i = 0 ; $i -lt $DataSourceItemGroup .DataSource.Count ; $i ++ ) {
145+ $RdsPath = $ProjectRoot | Join-Path - ChildPath $DataSourceItemGroup .DataSource [$i ].Include
145146
146147 $DataSource = New-SSRSDataSource - Proxy $Proxy - RdsPath $RdsPath - Folder $DataSourceFolder - Overwrite $OverwriteDataSources
147148 $DataSourcePaths.Add ($DataSource.Name , $DataSource.Path )
157158 $DataSetPaths.Add ($DataSet.Name , $DataSet.Path )
158159 }
159160 }
161+
162+ $ReportsItemGroup = $Project.Project.ItemGroup | Where-Object { $_.FirstChild.LocalName -eq ' Report' }
163+ for ($i = 0 ; $i -lt $ReportsItemGroup.Report.Count ; $i ++ ) {
160164
161- for ($i = 0 ; $i -lt $Project.Project.ItemGroup [1 ].Report.Count; $i ++ ) {
162-
163- $extension = $Project.Project.ItemGroup [1 ].Report[$i ].Include.Substring($Project.Project.ItemGroup [1 ].Report[$i ].Include.length - 3 , 3 )
165+ $extension = $ReportsItemGroup.Report [$i ].Include.Substring($ReportsItemGroup.Report [$i ].Include.length - 3 , 3 )
164166
165167 if (ImageExtensionValid - ext $extension ){
166168
167- $PathImage = $ProjectRoot | Join-Path - ChildPath $Project .Project.ItemGroup [ 1 ] .Report[$i ].Include
169+ $PathImage = $ProjectRoot | Join-Path - ChildPath $ReportsItemGroup .Report [$i ].Include
168170 $RawDefinition = Get-Content - Encoding Byte - Path $PathImage
169171
170172 $DescProp = New-Object - TypeName SSRS.ReportingService2010.Property
179181
180182 $Properties = @ ($DescProp , $HiddenProp , $MimeProp )
181183
182- $Name = $Project .Project.ItemGroup [ 1 ] .Report[$i ].Include
184+ $Name = $ReportsItemGroup .Report [$i ].Include
183185 Write-Verbose " Creating resource $Name "
184186 $warnings = $null
185- $Results = $Proxy.CreateCatalogItem (" Resource" , $Project .Project.ItemGroup [ 1 ] .Report[$i ].Include, $Folder , $true , $RawDefinition , $Properties , [ref ]$warnings )
187+ $Results = $Proxy.CreateCatalogItem (" Resource" , $ReportsItemGroup .Report [$i ].Include, $Folder , $true , $RawDefinition , $Properties , [ref ]$warnings )
186188 }
187189 }
188190
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
191+ for ($i = 0 ; $i -lt $ReportsItemGroup .Report.Count ; $i ++ ) {
192+ if ($ReportsItemGroup .Report [$i ].Include.EndsWith(' .rdl' )){
193+ $CompiledRdlPath = $ProjectRoot | Join-Path - ChildPath $OutputPath | join-path - ChildPath $ReportsItemGroup .Report [$i ].Include
194+ New-SSRSReport - Proxy $Proxy - RdlPath $CompiledRdlPath - RdlName $ReportsItemGroup .Report [$i ].Include
193195 }
194196 }
195197
@@ -208,4 +210,4 @@ function ImageExtensionValid($ext){
208210 }
209211
210212 return $valid ;
211- }
213+ }
0 commit comments