IVAN GURU
IVAN GURU

Reputation: 21

[DirectoryNotFoundException: Could not find a part of the path

Im new in ASP.NET MVC C#, And I am using ReportViewerForMVC on my project. With this one https://reportviewerformvc.codeplex.com/wikipage?title=Getting%20Started

On my local development I am able to find my report file like on this one reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\YourLocalReport.rdlc";

All working on development mode but when I deployed my project., got an error [DirectoryNotFoundException: Could not find a part of the path ] which the code couldnt find the specific file. My deployment package has no Reports folder on it. Is it the reason? If yes, then how to add my Reports folder in creating the Deployment Package..

Developing on Visual Studio 2013, Windows 8 Deployed Server: Windows Server 2008 R2

Thank You

Upvotes: 2

Views: 2335

Answers (2)

Ben
Ben

Reputation: 1092

I just got tripped up by this tonight - make sure that there are no spaces in your directory path - I was publishing to C:\inetpub\Corporate Webiste\ and when I removed the space it worked.

Upvotes: 0

mason
mason

Reputation: 32694

Right click the reports in your folder and set the Build Action to Content. That will include them when you publish.

Upvotes: 5

Related Questions