DataSource in Msbuild

Dec 3, 2012 at 12:22 PM

 

 

 

<Target Name="SetReportsDataSource">

<

SetReportDataSource ReportServerURL="$(ReportingServerURL)" Recursive="true" ReportItem="$(ProjectReportFolder)" DataSources="$(ReportServerDataSourceName)" UseMatchCase="True"/> </Target>

The above code set the datasource in my report, but i have run the msbuild script i got follwing error:

(SetReportsDataSource target) ->
D:\Mercurial\OTS\BuildReport.xml(78,5): Reporting error SetReportDataSource:
System.Web.Services.Protocols.SoapException: The value of parameter 'DataSource
s' is not valid. ---> Microsoft.ReportingServices.Diagnostics.Utilities.Invalid
ParameterException: The value of parameter 'DataSources' is not valid.

Please any one help me is this very urgent.

Coordinator
Dec 3, 2012 at 6:44 PM

Hi

   It looks like the MSBuild project is setting the value of the DataSource value incorrectly.  Would you be able to send me the full MS build project file so I can try figure out what is causing the error,

Regards

Steve

Dec 4, 2012 at 8:44 AM
StevenJWright wrote:

Hi

   It looks like the MSBuild project is setting the value of the DataSource value incorrectly.  Would you be able to send me the full MS build project file so I can try figure out what is causing the error,

Regards

Steve

<?xml version="1.0" encoding="utf-8" ?>


<Project InitialTargets="FullDeploy" DefaultTargets="FullDeploy" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >

<!--Import the Natvie mode tasks for deploying the reports -->

<Import Project="$(MSBuildExtensionsPath)\SSRSMSBuildTasks\ssrsmsbuildtasks.R2.tasks" />

<!--ReportServer -->

<PropertyGroup> <ServerURL>http://localhost:80/reportserver</ServerURL>

<SQLServer>$(COMPUTERNAME)\LOCALINSTANCE</SQLServer >

<ProjectReportRoot>/</ProjectReportRoot >

<ProjectReportFolder>TpReportingCenter</ProjectReportFolder >

<ReportServerdb>TpLocalCfgDB</ReportServerdb >

<Reportingdb>msdb</Reportingdb >

<ProjectReportDataSources>Dev_TpLocalCfgDB</ProjectReportDataSources >

<ReportServerDataSourceName>Dev_TpLocalCfgDB</ReportServerDataSourceName >

</PropertyGroup >

 <!--Reports & DataSoucre -->

<ItemGroup >

<!--The Include is the Name of the DataSource to create -->

<ReportDataSourceToDeploy Include="TpLocalCfgDB" >

<ConnectionString>Data Source=$(SQLServer);initial catalog=$(ReportServerdb);User Id=test;;Password=test</ConnectionString >

<Folder>$(ProjectReportDataSources)</Folder >

<Provider>SQL</Provider >

<OverWrite>True</OverWrite >

</ReportDataSourceToDeploy >

<ReportsToDeploy Include="$(MSBuildProjectDirectory)\test\report\*.rdl" />

</ItemGroup >

<PropertyGroup >

<FullDeployDependsOn >

GetServerURL;

DeleteFolders;

CreateReportingFolders;

CreateConnectionSources;

DeployReports;

SetReportsDataSource;


</FullDeployDependsOn >

</PropertyGroup >

<Target Name="FullDeploy" DependsOnTargets="$(FullDeployDependsOn)" />

<!--Get Full Server URL -->

<Target Name="GetServerURL" >

<GetFullURL ServerURL="$(ServerURL)" IsIntergatedMode="False" >

<Output TaskParameter="ReportServerUrl" PropertyName="ReportingServerURL" />

</GetFullURL >

</Target >

<Target Name="DeleteFolders" >

<!--Checking and deleteing Project Report Folder -->

<ReportFolderExists ReportServerURL="$(ReportingServerURL)" Folder="/" FolderName="TpReportingCenter" >

<Output TaskParameter="Exists" PropertyName="ReportItemExists" />

</ReportFolderExists >

<DeleteReportFolder ReportServerURL="$(ReportingServerURL)" Folder="TpReportingCenter" Condition="$(ReportItemExists) == True" />

</Target >

<Target Name="CreateReportingFolders" >

<!--Create the Report Folders -->

<CreateReportFolder ReportServerURL="$(ReportingServerURL)" NewFolderPath="$(ProjectReportFolder)" />

<CreateReportFolder ReportServerURL="$(ReportingServerURL)" NewFolderPath="$(ProjectReportDataSources)" />

</Target >

<Target Name="CreateConnectionSources" >

<!--This will create the reporting data source -->

<CreateReportingDataSource ReportServerURL="$(ReportingServerURL)" DataSources="@(ReportDataSourceToDeploy)" />

</Target >

<Target Name="DeployReports" >

<!--This will upload the reports to folder name -->

<AddReports ReportServerURL="$(ReportingServerURL)" Folder="$(ProjectReportFolder)" ReportFiles="@(ReportsToDeploy)" />

</Target >

 <Target Name="SetReportsDataSource">

<!--Loop through the all the reports within the folder (and sub-folder) and assign the location of the named reports data source if it's in the list (which will need to be otherwise the build will fail) -->

<SetReportDataSource ReportServerURL="$(ReportingServerURL)" Recursive="true" ReportItem="BillingWithProfile.rdl" DataSources="@(ReportServerDataSourceName)" UseMatchCase="False" />

</Target >

</Project >

 

Here i have attached my msbuild file.while running this file Report and datasource configrued successfully but datasource is not set report file.

Please help me,Very urgent.

Thanks & Regards,
Ramesh
 

 

Coordinator
Dec 4, 2012 at 8:08 PM
Edited Feb 3, 2014 at 11:54 AM
Hi Ramesh

Thank you for sending me the whole msbuild file. I believed that the problem was cause by the following in bold :<SetReportDataSource ReportServerURL="$(ReportingServerURL)" Recursive="true" ReportItem="$(ProjectReportFolder)"DataSources="$(ReportServerDataSourceName)" UseMatchCase="True"/> </Target>

This because project file was trying to pass in a parameter to property that was looking for a ITaskItem which are passed in by @().

Now from you reply to message it looks like you have correct that issues.

So if you are still getting the error then the problem is that report name for the datasource doesn't match to the name in the include which would mean that you need to set the metadata of ReportDataSourceNames to include the name of datasource within the report.

Regards Steve
Dec 5, 2012 at 5:56 AM

Hi Steve,

  • i have change the code, but i got error message;.Please help me.

Code:

<SetReportDataSource ReportServerURL="$(ReportingServerURL)" Recursive="true" ReportItem="$(ProjectReportFolder)" DataSources="@(ReportDataSourceToDeploy)" UseMatchCase="True" />

 Error:

 D:\Mercurial\OTS\BuildReport.xml" (FullDeploy target) (1) ->
(SetReportsDataSource target) -> D:\Mercurial\OTS\BuildReport.xml(78,5): error MSB4018: The "SetReportDataSource" task failed unexpectedly.\r
D:\Mercurial\OTS\BuildReport.xml(78,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.\r
D:\Mercurial\OTS\BuildReport.xml(78,5): error MSB4018:    at ssrsmsbuildtasks.RS2008R2.SetReportDataSource.Execute()\r
D:\Mercurial\OTS\BuildReport.xml(78,5): error MSB4018:    at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucke
t bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)

  • After that i have change the datasource coding "ReportDataSourceToDeploy" to "ReportServerDataSourceName".i am getting same error.

Code:

<SetReportDataSource ReportServerURL="$(ReportingServerURL)" Recursive="true" ReportItem="$(ProjectReportFolder)" DataSources="@(ReportServerDataSourceName)" UseMatchCase="True" />

How to set  metadata of ReportDataSourceName .please tell me the syntax..

 Thanks & Regards,

Ramesh

Coordinator
Dec 5, 2012 at 3:28 PM

Hi Ramesh

    Another issue with the MSBuild file is you don't have a item group called ReportServerDataSourceName.  Your  Item group name for the Reporting Services Share Data Source is call: ReportDataSourceToDeploy.  So you need to change the following line:

<SetReportDataSource ReportServerURL="$(ReportingServerURL)" 
Recursive="true" 
ReportItem="$(ProjectReportFolder)"
DataSources="@(ReportServerDataSourceName)"
UseMatchCase="True"/>

to this:

<SetReportDataSource ReportServerURL="$(ReportingServerURL)"
Recursive="true"
ReportItem="$(ProjectReportFolder)"
DataSources="@(ReportDataSourceToDeploy)"
UseMatchCase="True"/>

Regards

Steve Wright

Dec 6, 2012 at 6:05 AM

Hi Steve Wright,

I have changed my code as per your suggestion,but still i got error message "DataSources is not valid". Still datasource does not set my report file. Bellow i have attached the error and code. Please help me.

Error:

D:\Mercurial\OTS\BuildReport.xml" (FullDeploy target) (1) ->(SetReportsDataSource target) ->
D:\Mercurial\OTS\BuildReport.xml(84,5): Reporting error SetReportDataSource:System.Web.Services.Protocols.SoapException: The value of parameter 'DataSources' is not valid. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidParameterException: The value of parameter 'DataSources' is not valid.
D:\Mercurial\OTS\BuildReport.xml(84,5): Reporting error SetReportDataSource: at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.SetItemDataSources(String Item, DataSource[] DataSources)
D:\Mercurial\OTS\BuildReport.xml(84,5): Reporting error SetReportDataSource: at Microsoft.ReportingServices.WebServer.ReportingService2010.SetItemDataSources(String ItemPath, DataSource[] DataSources)

Changed Code:

<SetReportDataSource ReportServerURL="$(ReportingServerURL)" Recursive="true" ReportItem="$(ProjectReportFolder)" DataSources="@(ReportDataSourceToDeploy)" UseMatchCase="True"/>

Full Code:

<?xml version="1.0" encoding="utf-8" ?>
<Project InitialTargets="FullDeploy" DefaultTargets="FullDeploy" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- Import the Natvie  mode tasks for deploying the reports-->
  <Import Project="$(MSBuildExtensionsPath)\SSRSMSBuildTasks\ssrsmsbuildtasks.R2.tasks" />

  <!--ReportServer-->
  <PropertyGroup>  
    <ServerURL>http://localhost:80/reportserver</ServerURL>
    <SQLServer>$(COMPUTERNAME)\LOCALINSTANCE</SQLServer>      
    <ProjectReportRoot>/</ProjectReportRoot>
    <ProjectReportFolder>TpReportingCenter</ProjectReportFolder>
    <ReportServerdb>TpLocalCfgDB</ReportServerdb>   
    <ProjectReportDataSources>Data Sources</ProjectReportDataSources>
    <ReportServerDataSourceName>Dev_TpLocalCfgDB</ReportServerDataSourceName>  
  </PropertyGroup>
 
  <!--Reports & DataSoucre-->
  <ItemGroup>
    <!--The Include is the Name of the DataSource to create-->
    <ReportDataSourceToDeploy Include="$(ReportServerDataSourceName)">
      <ConnectionString>Data Source=$(SQLServer);initial catalog=$(ReportServerdb);User Id=sa;Password=password@123</ConnectionString>
      <Folder>$(ProjectReportDataSources)</Folder>    
      <Provider>SQL</Provider>
      <OverWrite>True</OverWrite>    
    </ReportDataSourceToDeploy>   
    <ReportsToDeploy Include="$(MSBuildProjectDirectory)\Country Solution\TpReportingCenter\*.rdl" />
  </ItemGroup>

  <PropertyGroup>
    <FullDeployDependsOn>
      GetServerURL;    
      DeleteFolders;
      CreateReportingFolders;
      CreateConnectionSources;  
      DeployReports;    
      SetReportsDataSource;    
    </FullDeployDependsOn>
  </PropertyGroup>

  <Target Name="FullDeploy" DependsOnTargets="$(FullDeployDependsOn)" />

  <!--Get Full Server URL-->
  <Target Name="GetServerURL">
    <GetFullURL ServerURL="$(ServerURL)" IsIntergatedMode="False">
      <Output TaskParameter="ReportServerUrl" PropertyName="ReportingServerURL" />
    </GetFullURL>
  </Target>

  <Target Name="DeleteFolders">
    <!--Checking and deleteing Project Report Folder-->
    <ReportFolderExists ReportServerURL="$(ReportingServerURL)" Folder="/" FolderName="TpReportingCenter">
      <Output TaskParameter="Exists" PropertyName="ReportItemExists" />
    </ReportFolderExists>
    <DeleteReportFolder ReportServerURL="$(ReportingServerURL)" Folder="TpReportingCenter" Condition="$(ReportItemExists) == True"/>
  </Target>

  <Target Name="CreateReportingFolders">
    <!-- Create the Report Folders -->
    <CreateReportFolder ReportServerURL="$(ReportingServerURL)" NewFolderPath="$(ProjectReportFolder)" />
    <CreateReportFolder ReportServerURL="$(ReportingServerURL)" NewFolderPath="$(ProjectReportDataSources)" />   
  </Target>

  <Target Name="CreateConnectionSources">
    <!--This will create the reporting data source -->
    <CreateReportingDataSource ReportServerURL="$(ReportingServerURL)" DataSources="@(ReportDataSourceToDeploy)" />
  </Target>

  <Target Name="DeployReports">
    <!--This will upload the reports to folder name-->
    <AddReports ReportServerURL="$(ReportingServerURL)" Folder="$(ProjectReportFolder)" ReportFiles="@(ReportsToDeploy)" />   
  </Target>

  <Target Name="SetReportsDataSource"> 
    <!--Loop through the all the reports within the folder (and sub-folder) and assign the location of the named reports data source if it's in the list (which will need to be otherwise the build will fail)-->      
    <SetReportDataSource ReportServerURL="$(ReportingServerURL)" Recursive="true" ReportItem="$(ProjectReportFolder)" DataSources="@(ReportDataSourceToDeploy)" UseMatchCase="True"/>
  </Target>

</Project>

 

Thanks & Regards,

Ramesh

Dec 18, 2012 at 8:07 AM

Hi Steve Wright,

i have find the solution, now it's working fine.

Thanks & Regards,

Ramesh

Nov 5, 2013 at 3:09 PM
Hi Ramesh,

I am having the same issue.. what was the solution for it?

Thanks,
Dhaval Shah
dhaval.shah01@gmail.com
Jan 31, 2014 at 1:03 PM
Hi,

Does anyone have an update on how this was fixed?

Thanks,
Chris.
Coordinator
Feb 3, 2014 at 12:00 PM
Hi ChrisFraelic
Would you be able to e-mail your deployment file and copy of the error you are getting?   I will try and have a look at the problem.  
Regards
Steve
Feb 3, 2014 at 12:22 PM
Hey Steve,

Actually - it was because the DS name in the script was not the same as the name in the project '*Dw' vs '*DW'

I guess it's pretty picky :)

Thanks for the reply,
Chris.