timabell/ssrs-powershell-deploy

Works correctly only if a .rptproj file contains more then one Report and DataSource

Opened this issue ยท 3 comments

Who faced to with the same limitations.

Error in PowerShell if only one item in XML (one report or one DataSource):
Publish-SSRSProject : The property 'Count' cannot be found on this object. Verify that the property exists

Error, if there are not DataSources in the rpproj file:
Publish-SSRSProject : The property 'DataSource' cannot be found on this object. Verify that the property exists.

You should add at least two items for every node:

  <ItemGroup>
    <Report Include="TestReport1.rdl" />
    <Report Include="TestReport2.rdl" />
  </ItemGroup>  
  <ItemGroup>
    <DataSource Include="SharedDataSourceTest.rds" />
    <DataSource Include="SharedDataSourceTest2.rds" />
  </ItemGroup>

Via Visual Studio:
image

Error here:
image
(before merge #25)

Would be grate if anybody remove these limitations.

Hi,
I experienced the same problem. Seems like the dotted notation is unreliable.
When using selectNodes it is working, also when only one DataSet/Report. However it only works when the schema xmlns attribute is not referenced in the root element, unless using
an XmlNamespaceManager
Not sure if that is a good solution, I need to do some more reading and tests on it. I welcome feed back :)

$ns = New-Object System.Xml.XmlNamespaceManager($Project.NameTable)
    $ns.AddNamespace("msbld", $Project.DocumentElement.NamespaceURI)

    $DataSourcePaths = @{}
    $Project.SelectNodes("//msbld:DataSource", $ns) |
	   ForEach-Object {
		  $RdsPath = $ProjectRoot | Join-Path -ChildPath $_.Include
		  $DataSource = New-SSRSDataSource -Proxy $Proxy -RdsPath $RdsPath -Folder $DataSourceFolder -Overwrite $OverwriteDataSources
		  $DataSourcePaths.Add($DataSource.Name, $DataSource.Path)
	   }

https://blogs.technet.microsoft.com/georgewallace/2014/11/13/using-selectsinglenode-in-powershell-with-xml-namespace-azure-vnetconfig/

@vminds I tried your solution and it works fine for the DataSources. Would be cool if you could come up with a PR that includes the Report.Count path as well.

I did add some more features such as removing datasource/reports using the Microsoft/ReportingServicesTools. Need to finalize and generalize the code and plan to add it as a fork of this repo.