0

I am using hosted build and its failing with error, can not find the assembly crystal report. How can I use crystal report using hosted build agent?

Matt
  • 3,658
  • 3
  • 14
  • 27
VishwajeetMCA
  • 139
  • 2
  • 12

2 Answers2

3

While it is true that hosted agents do not come with Crystal Reports for Visual Studio installed, the COM components are not required to perform a compile. All you need to build are copies of the .NET DLLs that your application references.

One workaround is to add the DLLs you reference to the repository and do a conditional hint path to use them when they are not installed in the default location on the machine.

<Reference Include="CrystalDecisions.CrystalReports.Engine, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath Condition="!Exists('$(MSBuildProgramFiles32)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet\CrystalDecisions.CrystalReports.Engine.dll')">..\..\lib\CrystalDecisions.CrystalReports.Engine.dll</HintPath>
  <Private>False</Private>
</Reference>
<Reference Include="CrystalDecisions.ReportSource, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath Condition="!Exists('$(MSBuildProgramFiles32)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet\CrystalDecisions.ReportSource.dll')">..\..\lib\CrystalDecisions.ReportSource.dll</HintPath>
  <Private>False</Private>
</Reference>
<Reference Include="CrystalDecisions.Shared, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath Condition="!Exists('$(MSBuildProgramFiles32)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet\CrystalDecisions.Shared.dll')">..\..\lib\CrystalDecisions.Shared.dll</HintPath>
  <Private>False</Private>
</Reference>
<Reference Include="CrystalDecisions.Windows.Forms, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath Condition="!Exists('$(MSBuildProgramFiles32)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet\CrystalDecisions.Windows.Forms.dll')">..\..\lib\CrystalDecisions.Windows.Forms.dll</HintPath>
  <Private>False</Private>
</Reference>

Here, the DLLs were placed in a folder named lib at the root of the repository. The !Exists condition checks whether the DLL is at the default location, and if not will switch to using the local one in the lib folder.

Alternatively, rather than checking binaries into your repository you could host them on a private NuGet feed or a MyGet feed. Do note that there are also unofficial copies of these libraries on NuGet that you could reference, but it is often not clear what version of the binaries the package authors have submitted.

NightOwl888
  • 55,572
  • 24
  • 139
  • 212
1

Crystal report can not build by Hosted agent since the Hosted agent not installed Crystal reports for visual studio.

You should build the crystal report by private agent which installs the Crystal reports for visual studio.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74