Friday, February 24, 2012

Custom code assembly with config file

Hi!

My report has a reference to an assembly of a class library I did. This class library has a config file, classLibrary.dll.config, where I set some parameters, one of these being the "initial path" to the project's folder(for example, project folder is myProject, and you would use the initial path to say it's in c:/projects/tests). When I preview the report everything works fine, but when I publish it I get this error:

Absolute path information is required.

I guess it's not reading the dll.config file, so it can't see the initial path value and concatenate it with the project's folder. I'm supposing this because at first, I forgot to copy the dll.config file to the Microsoft Visual Studio 8/Common7/IDE/PrivateAssemblies folder and I got the same error when trying to preview the report. Copying it to this folder solved the problem. So I think I'm not placing the dll.config file in the rigth folder (I'm copying it to Microsoft SQL Server/MSSQL/ReportServer/bin). If I don't use the config file, I mean, if I put the absolute path directly in the code, everything works, but this is just something I can't do! Can anyone help me?

Thank you!

what happens if you copy config file to reportserver/bin and give 'everyone' read access to it?|||

Hi!

It still can't see the config file... My class library has two classes, Class A uses Class B. Can I use only Class A ddl or should I put both dll files in the rssrvpolicy.config?

Thank you!

|||You should put both|||

Hi!

Still have the problem... When I try to preview the assembly location using Assembly.GetExecutingAssembly().Location, it shows me the rigth path to the dll file. When I try to see it from the published report, I get #Erro on the textbox. Is this write?

Thank you!

|||

Take a look at the logfiles at:
\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\LogFiles
Usually they can help you..
Hint:
Stop Reporting Services and WWW-Publishing, delete all old Logfiles, and restart the services. So you can easily find the right logfiles..

|||

Hi!

Thanks for the post, I'll take a look on the log files... But I'm wondering if there is a simpler way to do what I'm trying to do. I'm doing all this because I can't have in my code an absolute path to a xml file configurable by the user. I know that, if it was a web page, I could use Server.MapPath("file.xml") to made it relative to the project path. Can't I do something like this with a Class Library? Or is the config file the only solution?

Thank you!

No comments:

Post a Comment