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

4 posts, 1 answers
  1. Mike
    Mike avatar
    8 posts
    Member since:
    Mar 2014

    Posted 30 Apr 2014 Link to this post

    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?
  2. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 01 May 2014 Link to this post

    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.

     
  3. Answer
    Stef
    Admin
    Stef avatar
    3610 posts

    Posted 02 May 2014 Link to this post

    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.

     
  4. Sunil
    Sunil avatar
    1 posts
    Member since:
    Dec 2014

    Posted 18 Dec 2014 in reply to Stef Link to this post

    @Stef.
    Your solution is perfect. This is exactly what I was looking for.

    Thanks. You save my lots of time.

    Cheers
    ~Sunil
Back to Top