Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crazy Deep Path Length in .Net Core 1.1

Has anyone seen a problem in .NET Core 1.1 where beneath the netcoreapp1.1\publish folder they end up with a bin folder that seems to loop on itself and eventually causes a path too long message to appear in Windows. Trying to delete this folder in Windows Explorer cause a Source Too Long message to appear. The only solution was to use RoboCopy.

Here is an example of one of the generated paths:

bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\Debug\netcoreapp1.1\publish\bin\release\netcoreapp1.1\publish\bin\release\netcoreapp1.1\publish\bin\release\netcoreapp1.1\publish\bin\release\netcoreapp1.1\publish\bin\release\netcoreapp1.1\publish\Controllers\

Is this a problem caused by something I have setup incorrectly?

The last cleanup returned the following stats:

Folders: 6866 Files: 7391

I am publishing using the following command:

dotnet publish -c debug

It seems each publish makes the folder structure deeper and this seems to be related to the CSHTML files in my project creating this folder structure:

\publish\bin\debug\netcoreapp1.1\publish\Controllers\Account\Views

Then on second build this structure:

  \publish\bin\debug\netcoreapp1.1\publish\bin\debug\netcoreapp1.1\publish\Controllers\Account\Views

And so on...

I am using SDK 1.0.0-preview2-1-003177

like image 693
Michael Edwards Avatar asked Mar 04 '17 08:03

Michael Edwards


2 Answers

I remember that I had same issue with preview2 of .NET Core SDK. It was fixed in either preview3 or preview4. And it is definitely fixed in .NET Core SDK 1.0. as mentioned by @Marc. Just update you SDK https://www.microsoft.com/net/download/core#/sdk.

With new SDK your project will be converted to csproj and MSBuild, so no project.json anymore.

EDIT: Project will automatically be converted in VS 2017, if you use command line tool you should apply dotnet-migrate command.

like image 76
Andrii Litvinov Avatar answered Sep 20 '22 14:09

Andrii Litvinov


Try updating the sdk to release version available now. Version 1.0 and version 1.1 are (at the time of this post) included in one package download from here. https://www.microsoft.com/net/download/core

as Mentioned by @Andrii Litvinov the migration will occur for VS2017. if you need help: Microsoft is offering free migration help for project.json to msbuild. (as of the time of this update march 15 2017]

check out: http://landinghub.visualstudio.com/migrate-dotnetcore

like image 23
Marcus Avatar answered Sep 19 '22 14:09

Marcus