We are facing below error while running build.cake
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.
please provide any work around for this
Note : Already we tried long path module like below manner
build.ps1 :
#Load Longpath Module
Write-Host "Restoring long path module..."
try
{
echo $PSScriptRoot
Invoke-Expression "& cmd /c $PSScriptRoot/longpath.cmd"
}
catch{
throw new Exception("Long path nuget not restored.");
}
created lonpath.cmd file and restored longpath module nugets in modules folder and called build cake at end of line of cmd file like below
`
@ECHO OFF
pushd %~dp0
IF NOT EXIST "%~dp0\tools" (md "tools")
IF NOT EXIST "%~dp0\tools\modules" (md "tools\modules")
IF NOT EXIST "%~dp0\tools\nuget.exe" (@powershell -NoProfile -ExecutionPolicy Bypass -Command "(New-Object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe','tools/nuget.exe')")
IF NOT EXIST "%~dp0\tools\Cake" (tools\nuget.exe install Cake -ExcludeVersion -OutputDirectory "Tools" -Source https://www.nuget.org/api/v2/)
IF NOT EXIST "%~dp0\tools\modules\Cake.LongPath.Module" (tools\nuget.exe install Cake.LongPath.Module -PreRelease -ExcludeVersion -OutputDirectory "%~dp0\tools\modules" -Source https://www.nuget.org/api/v2/)
%~dp0\tools\Cake\Cake.exe build.cake -target="LoadlongPath"
build.cake
Task("LoadlongPath")
.Does(() =>
{
var fileSystemType = Context.FileSystem.GetType();
Information(fileSystemType.ToString());
if (fileSystemType.ToString()=="Cake.LongPath.Module.LongPathFileSystem")
{
Information("Suscessfully loaded {0}", fileSystemType.Assembly.Location);
}
else
{
Error("Failed to load Cake.LongPath.Module");
}
});