Friday, February 17, 2012

Custom assembly : Retrieving data from from configuration file.

Hi all,

my problem is that: I do read informations (e.g. connectionString) from configuration file by one custom assembly.
My environment is RS2005, VS.NET 2005 Prof.Edition, WIN2003 Server SP1, .NET Framework 2.0.50727
The scenario is that:
A text box into my report require a function contained into MyCustom.dll. This code do read information from MyCustom.dll.config.

This file contains:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="IS2009cfg" connectionString="data source=servername\instancename;initial catalog=dbname;user id=xx;password=yy;" />
</connectionStrings>
<appSettings>
<add key="DefaultHeaderLogo" value="This is a test" />
</appSettings>
</configuration>

Using
ConnectionStringSettings conn = ConfigurationManager.ConnectionStrings["IS2009cfg"];
the result is null.

Also using
string defaultHeaderLogo = ConfigurationManager.AppSettings["DefaultHeaderLogo"];
the result is null.

MyCustom.dll and MyCustom.dll.config are located into locations of Report Server and Report Designer, with this Build Events on succesfully build:

rem Copy custom assembly to ReportDesigner location...
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll" "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\MyCustom.dll"
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll.config" "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\MyCustom.dll.config"
rem Copy custom assembly to ReportServer location...
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll" "C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\MyCustom.dll"
copy "...mydeveloplocation...\bin\Debug\MyCustom.dll.config" "C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\MyCustom.dll.config"

The question is simple: where I do locate configuration file for obtain value during report execution?

Many thank's in advance

Claudio Barca
Turin - Italy

Hi, I have the same problem
Do you have solve it?
Thanks

No comments:

Post a Comment