AlHal2
asked on
VS says path name must be less than 260 characters. It is less, so why the message
I'm trying to start a new visual studio 2017 C# project and have selected it to be an MVC project with the web API checkbox checked. I've also checked the add unit test checkbox and changed the authentication to single user. After I click OK I'm getting this message.
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. The fully qualified file name is D:\OneDrive\Documents\Cour ses\QAASPN ETMVC\Labs \04 DataStorage\01 Setup Projects\Begin\QAForumSolu tion which is 103 characters.
Why am I getting this message?
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. The fully qualified file name is D:\OneDrive\Documents\Cour
Why am I getting this message?
the path you showed is a directory path. you have to add subfolders like Debug and project file names. if d: is not a local harddisk but a network drive, you also may consider that vs wants to resolve the name to an UNC path.
if nothing of those applies, you may close the solution in vis, then open the project file (.csproj) with a text editor and search for long path names.
Sara
if nothing of those applies, you may close the solution in vis, then open the project file (.csproj) with a text editor and search for long path names.
Sara
ASKER
HI Nikoloz,
Please can you explain what you mean by
Hi Sarabande,
This is the longest path I could find but is still only 179 characters.
D:\OneDrive\Documents\Cour ses\QAASPN ETMVC\Labs \04 DataStorage\01 Setup Projects\Begin\QAForumSolu tion\UI\ob j\Debug\Te mporaryGen eratedFile _036C0B5B- 1481-4323- 8D20-8F5AD CB23D92.cs
Please can you explain what you mean by
check your solution straight in D:\OneDrive\Documents\ folder and check itI have to select a folder for the solution before I press the OK button to create it.
Hi Sarabande,
This is the longest path I could find but is still only 179 characters.
D:\OneDrive\Documents\Cour
Are you using any NuGet packages? Are you using any third-party controls?
-saige-
-saige-
ASKER
I've not downloaded anything for the project. However MVC and web API projects have lots of stuff by default before the user does anything.
Can you created your project in folder D:\OneDrive\Documents and check the max length of the file? It is adding jquery libraries as well. It is depended on the options you check to include and MVC project version
ASKER
Hi Nikoloz,
It worked creating the project in the C drive. The longest path in the scripts directory is
C:\Users\ahalp\source\repo s\QAForumS olution\UI \Scripts\j query.vali date.unobt rusive.min .js
This is only 90 characters.
Do you think the problem could have been caused by using OneDrive or the fact that the previous filepath had spaces? https://onedrive.live.com/about/en-gb/
It worked creating the project in the C drive. The longest path in the scripts directory is
C:\Users\ahalp\source\repo
This is only 90 characters.
Do you think the problem could have been caused by using OneDrive or the fact that the previous filepath had spaces? https://onedrive.live.com/about/en-gb/
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open powershell window in your created solution and execute the following command to get fullname length of the files in the directory
dir -file -recurse | Foreach-Object {Write-Host $_.FullName.length, $_.FullName}
ASKER
This is the longest path I could find. It's only 231 characters.
D:\OneDrive\Documents\Cour ses\QAASPN ETMVC\Labs \04 DataStorage\01 Setup Projects\Begin\QAForumSolu tion\packa ges\Micros oft.Applic ationInsig hts.PerfCo unterColle ctor.2.2.0 \Microsoft .Applicati onInsights .PerfCount erCollecto r.2.2.0.nu pkg
I used this code to find it.
D:\OneDrive\Documents\Cour
I used this code to find it.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
foreach (string path in Directory.EnumerateFiles(@"D:\OneDrive\Documents\Courses\QAASPNETMVC\Labs\04 DataStorage\01 Setup Projects\Begin", "*.*", SearchOption.AllDirectories))
{
if (File.Exists(path))
{
// This path is a file
ProcessFile(path);
}
else if (Directory.Exists(path))
{
// This path is a directory
ProcessDirectory(path);
}
else
{
Console.WriteLine("{0} is not a valid file or directory.", path);
}
}
}
public void ProcessDirectory(string targetDirectory)
{
// Process the list of files found in the directory.
string[] fileEntries = Directory.GetFiles(targetDirectory);
foreach (string fileName in fileEntries)
ProcessFile(fileName);
// Recurse into subdirectories of this directory.
string[] subdirectoryEntries = Directory.GetDirectories(targetDirectory);
foreach (string subdirectory in subdirectoryEntries)
ProcessDirectory(subdirectory);
}
// Insert logic for processing found files here.
public void ProcessFile(string path)
{
using (StreamWriter sw = new StreamWriter(@"D:\OneDrive\Documents\Courses\QAASPNETMVC\Labs\04 DataStorage\01 Setup Projects\Begin\Results.csv",true))
{
sw.WriteLine(path.Length + "," + path);
}
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
192 characters
C:\Users\ahalp\source\repo s\QAForumS olution\pa ckages\Mic rosoft.App licationIn sights.Win dowsServer .Telemetry Channel.2. 2.0\Micros oft.Applic ationInsig hts.Window sServer.Te lemetryCha nnel.2.2.0 .nupkg
Using the previous file structure 252 characters
D:\OneDrive\Documents\Cour ses\QAASPN ETMVC\Labs \04 DataStorage\01 Setup Projects\Begin\QAForumSolu tion\packa ges\Micros oft.Applic ationInsig hts.Window sServer.Te lemetryCha nnel.2.2.0 \Microsoft .Applicati onInsights .WindowsSe rver.Telem etryChanne l.2.2.0.nu pkg
Thanks everyone. I know 252 is less than 260, but I think the point is made.
C:\Users\ahalp\source\repo
Using the previous file structure 252 characters
D:\OneDrive\Documents\Cour
Thanks everyone. I know 252 is less than 260, but I think the point is made.
MVC projects include some jquery libraries as well, so, check your solution straight in D:\OneDrive\Documents\ folder and check it