This is a migrated thread and some comments may be shown as answers.

Could not load file or assembly 'System.Net.Http.Formatting' error

3 Answers 478 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 2
Mike asked on 01 May 2014, 04:09 AM
I have all of my reports in a class library. This is the first report I have created using an object data source class to pull data from three different data sources into one report. (Note: This information is all joined into 1 record, not a sub report type data.)

My object data source looks like:

[DataObject]
class DailyInvoicing{   
    [DataObjectMethod(DataObjectMethodType.Select)]   
    public IList<DailyInvoice> GetDailyInvoices(DateTime dateEntered)   
    {
        // Build data set here
    }
}

Then built the report. That all seemed to work well. When go to preview the report, I get the following error: 

An error has occurred while processing Report 'DailyInvoicingReport': An error occurred while invoking data retrieval method. Try restarting Visual Studio.
------------- InnerException -------------
Exception has been thrown by the target of an invocation.
------------- InnerException -------------
Could not load file or assembly 'System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I have restarted VS and even tried a second computer. The reference is in the project AND it is in the bin folder after compiling. I am not sure what might be going on. To add to the strangeness, I thought maybe if I ran it through the rest of my project it might work. Instead I was greeted with the following error:

An error has occurred while processing Report 'DailyInvoicingReport': An error occurred while invoking data retrieval method.
------------- InnerException -------------
Exception has been thrown by the target of an invocation.
------------- InnerException -------------
Unable to load the specified metadata resource.


Any ideas on what I might be missing?

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 01 May 2014, 03:38 PM
Hello Mike,

Please manage the System.Net.Http.Formatting.dll from Nuget, then verify the start project has correct binding redirects for it and test running the application.

If the preview fails again, open a support ticket and send us a runnable demo project to check your settings.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Accepted
Stef
Telerik team
answered on 02 May 2014, 04:24 PM
Hello,

Just an update for anyone concerned:

"The reason is that on design preview, the start application is Visual Studio and the assembly is searched in the folder where is the devenv.exe.

Copy the assembly next to devenv.exe or display the report directly in the viewer."

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Sunil
Top achievements
Rank 1
answered on 19 Dec 2014, 12:05 AM
@Stef.
Your solution is perfect. This is exactly what I was looking for.

Thanks. You save my lots of time.

Cheers
~Sunil
Tags
General Discussions
Asked by
Mike
Top achievements
Rank 2
Answers by
Stef
Telerik team
Sunil
Top achievements
Rank 1
Share this question
or