1

I'm having a problem deploying an ASP.NET Core web app to a remote IIS server using Visual Studio 2017. Everything compiles and runs fine on my local machine but when I want to publish using VS, I keep getting error messages saying its unable to copy some files since the path length is too long.

I found a similar posting from 2015 but the selected answer there does not seem to work for me in VS2017.

I am able to publish manually via the CLI command:

dotnet publish -f netcoreapp2.2 -r win10-x64 --self-contained false -o c:\temp\publish

and then manually copy the output from the C:\temp\publish directory to the remote IIS server, but this seems unnecessarily long-winded given that Visual Studio 2017 has a publishing feature.

Does anyone know what settings need to be changed to get VS2017 to use a shorter path for its intermediate files instead of deepening the directory tree of my project directory?

RobbieE
  • 4,280
  • 3
  • 22
  • 36
  • 1
    How long is the path of the directory, that VS uses as target while publishing? Maybe you should define another target like _c:\temp\publish_ you mentioned – schlonzo Sep 20 '19 at 10:09
  • 1
    The path is definitely too long, that's not in dispute (It's longer than the 260 chars allowed). This is caused by VS's default intermediary directories being child directories of my project directory. As I mentioned above, I can change the location of the intermediary directory by using the `-o` argument on the CLI, but I don't know how to change it inside VS itself. In the previous post, the same thing happened but there was a solution for VS2015/asp.net-core1.0, but this no longer works in VS2017/asp.net-core2.2 – RobbieE Sep 20 '19 at 12:00

1 Answers1

0

keep your solution in simple path like d:\project\yourprojectname\youproject.sln and publish, IF there are so many subfolder then definitely it will throw error

Sunil Mathari
  • 822
  • 2
  • 11
  • 21
  • 2
    Thanks @sunil but I'm hoping there's a solution to this problem, similar to the one for VS2015/asp.net-core1.0. I already have a work-around by using the CLI to publish to a shorter directory, then manually copy to the remote server. – RobbieE Sep 20 '19 at 12:03