Click here to Skip to main content
15,117,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I can no longer build my project due to microsofts reportviewer names being too long.

The error I get is:
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

while copying to:

D'oh… now what?

Any ideas how I can around this? Can I override the temp publishing target to make the folder-name smaller?


What I have tried:

Building it over and over until it goes away; but it never does :(
Updated 2-Aug-20 2:13am
Richard MacCutchan 31-Jul-20 8:28am
The message is quite clear, the path is too long. So move the files to some location with shorter directory names.
dnibbo 2-Aug-20 6:36am
It is Visual Studio that generated the directory name not me :(
Richard MacCutchan 2-Aug-20 7:51am
Then perhaps you should open a question with Microsoft, it's their software.

Try this, as mentioned here: Website publish failing due to file path being too long | The ASP.NET Forums[^]
Add the following line in default PropertyGroup of web project file.

You can likely make the above path C:\temp to get it as close to root of the drive as possible.
dnibbo 2-Aug-20 6:53am
Hi Sandeep

Thanks for the reply, it did look hopeful but alas it does not fix the problem.
That path specifies where VS will compile to.
Once compiled, I have no idea why, it copies it to another temp publish folder called C:\Users\myusernamexx\AppData\Local\Temp\WebSitePublish\WebPortalNet4-872599845

I need to somehow get it to use a different path for that bit.
I have looked in that .pubxml to see if there are any other paths that can be overridden but cant see anything.

One site suggested <PublishTempFoldername>C:\Pub\ but that didn't seem to work.

Thanks to Sandeep for his suggestion, it did lead to a solution in the end.

There is another node you can add which overrides the publish folder.


It now works.
dnibbo 14-Aug-20 3:48am
Please note that the above does not work properly either.
Files seem to get to the c:\pub folder but not the deployment folder and manually copying does not work.
I am now getting: Parser Error Message: Could not load the assembly 'App_Web_uznma5bb'. Make sure that it is compiled before accessing the page.
The search goes on :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900