aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
256 stars 124 forks source link

Multiple publishes using msdeploy.exe causes directory repetition until file name is to long and crashes VS. #927

Closed Tratcher closed 7 years ago

Tratcher commented 7 years ago

From @ewhance on December 23, 2016 17:17

I'm using Visual Studio Enterprise 2015, version 14.0.25431.01 Update 3 and a .net core project. The SDK does not change the result.

Steps to reproduce:

  1. Create new .net core project.
  2. Create custom publish target.
  3. Default target location.
  4. Default settings.
  5. Publish.
  6. Observe the added directories after the msdeploy execution: '\bin\Release\PublishOutput\'.
  7. Publish again.
  8. Observe that the msdeploy execution has now created another set of directories inside the first: '\bin\Release\PublishOutput\bin\Release\PublishOutput'
  9. Repeat publish until file name becomes to long and crashes VS.

I also have found that even if I manually delete all of the published output as well as the publish profiles, the next publish still results in the same behavior.

Copied from original issue: aspnet/Home#1888

mlorbetske commented 7 years ago

@vijayrkn do you know the settings that should be in project.json to prevent bin from being included in publish?

vijayrkn commented 7 years ago

I think it can be added to the PublishOptions exclude.

  "publishOptions": {
    "exclude": [
      "bin\**",
      "obj\**",
    ]
  },

Even without these, the publish used to work in U3. It would be good to get a repro project to see what is causing the recursive copy. May be some custom pattern in publishOptions include could be causing this.

ewhance commented 7 years ago

I am using a new .net core project with all defaults.

SecondPublish.txt project.json.txt

vijayrkn commented 7 years ago

This looks like an issue with this pattern ("**/*.cshtml") in publish include which is causing all the cshtml files to be included from the publishOutput folder as well. In this case, it included all the cshtml files from bin\Release\PublishOutput\Views.

This issue is not specific to VS tooling. I think this issue will repro if you delete bin\Release folder and run this command from commandline multiple times.

C:\Program Files\dotnet\dotnet.exe publish "C:\Projects\New folder\WebApplication1\src\WebApplication1" --framework netcoreapp1.0 --output "bin\Release\PublishOutput" --configuration Release

You may have to add this to PublishOptions exlude - bin\Release\PublishOutput.

ewhance commented 7 years ago

The issue is resolved if the pattern "*/.cshtml" is removed or replaced. I replaced it with "Views".

derekpec commented 7 years ago

I'm having the exact same issue (https://github.com/Microsoft/msbuild/issues/2185) and removing/replacing **/*.cshtml and/or adding bin/** to exclude section in project.json did not, unfortunately, fix it for me.