Error generating Report after installing nuget pacakge

  • Last Post 12 March 2017
  • Topic Is Solved
dotnetreport admin posted this 12 March 2017 - Last edited 12 March 2017

I followed the setup instructions, and I successfully installed the nuget package, updated the api keys, and was able to edit/create a report. However, when I try to run the report, it gives me a compliation error that DotNetReportModel is not found.


Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'DotNetReportModel' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 41:     
Line 42:     
Line 43:     public class _Page_Views_dotnetreport_Report_cshtml : System.Web.Mvc.WebViewPage {
Line 44:         
Line 45: #line hidden


Please advise. Thanks 

  • Liked by
  • dotnetreport
dotnetreport posted this 12 March 2017

The reason for this error is that mvc cannot find the model definition as it's missing the namespace. You can solve this in different ways. One is to open up the view file "/Views/DotNetReport/Report.cshtml" and include the model's fully qualified namespace:

@model YourProjectName.Models.DotNetReportModel

A better approach is to add it in the View's web.config. Open up Views/web.config file, and add the following in the <system.web.webPages.razor> section:

<add namespace="YourProjectName.Models" />

This should resolve the issue.

  • Liked by
  • dotnetreport admin