Greg
Greg

Reputation: 119

DotNet Core Publish to File System Results in bin directory repitition many levels deep

Using Visual Studio 2015 Update 3 and publishing a web project (Identity Server in this case, but that's not relevant really) results in a replication of the Debug directory that goes so deep that the file system can no longer read it.

PublishFolder/bin/Release/netcoreapp1.0/bin/Debug/netcoreapp1.0/bin...

Inside each version of the netcoreapp1.0 directory, there are two directories: The afforementioned bin which repeats the directory structure and a UI directory that has a replication of the base project's UI directory.

This goes on for so many levels deep that I can't even use Windows Explorer or CMD in order to remove it. I have to use a separate tool like 7Zip's File Manager. Also, even when removing the levels, I can't copy that directory anywhere else as it then fails stating that it can't find one of those directories that was deleted, even with copy/paste after the deletion.

Is there a script that handles the publishing that would put a never-ending Debug/netcoreapp1.0/bin... repitition inside a Release directory? (I also don't know why it's publishing a /Debug under the /Release, but I can live with it if it's not so deep.)

This problem happens for the Debug profile as well. But there, it goes even deeper. The problem is it also persists/returns after the Debug and Release directories are deleted from the source code directories. And, even after a rebuild all then deploy. In the source code directory itself, after a build, it's only one level deep (e.g., Release/netcoreapp1.0/bin/debug/netcoreapp1.0/bin) but upon publication, it's multiple levels deep.

Update: It seems that post-release, I can simply delete the /bin directory from the root and everything still functions just fine post-deploy. Should this directory be deploying in the first place?

Upvotes: 2

Views: 482

Answers (1)

jtlowe
jtlowe

Reputation: 857

Found this section titled "To infinity and beyond" on the post The basics of publishing your .NET Core web app

In the projects.json file, if you use a wildcard to include all .cshtml files (such as **.cshtml), publish will look for all .cshtml files within the application folder, including the ones already published to the bin folder. Further publishes will find the nested .cshtml files in the bin folder and keep nesting these further. In my project.json file, I changed my publishOptions to this:

"publishOptions": {
  "include": [
    "Views/**/*.cshtml",
      ...,
      ...
  ]
},

Upvotes: 1

Related Questions