Reputation: 1226
Visual Studio has a Publish feature, and one of the options is to publish to a folder - I use it to determine which files to include in my InnoSetup installer because I have a complex project and it's actually pretty hard to figure out which files to include.
I got a new computer, installed VS including the publish component. Everything runs without any errors, but no files appear in the destination folder :-(
Anyone else having this problem? It is very simple to setup so I have no idea how to fix.
Run publish, no errors and no files:
Upvotes: 5
Views: 1147
Reputation: 1
Using VS 2022 17.12.13, but this occurred in an earlier 2022 version, not sure which. Did a clean install trying to fix this.
My setup may be rare, I have only the “.NET desktop development” workload installed.
When trying to publish to a folder using the "Folder" option, the process fails silently. VS says “Publish succeeded” but no files are created.
When trying to publish to a folder using the "ClickOnce" option, get this error message, and no files are created: Could not find a part of the path 'D:\Dev\xxxx\bin\Release\net8.0-windows\app.publish'.
Workaround: I tried everything mentioned here and many other posts, no help. Finally tried adding the “Windows application development” workload. Making no other changes, tried publishing the original project again. Success!
Later, I removed the “Windows application development” workload. Publishing still works. Perhaps VS tracks workload components like Windows tracks dlls, and didn't remove publishing since it is (should be) part of the original workload.
Upvotes: 0
Reputation: 1730
Based on ChenYiLins answer, dotnet publish -p:PublishProfile=FolderProfile
did not work for me.
First step is to create a publish-profile in VS and edit it to your liking. If it is FolderBased, it most probably will be named FolderProfile. Then create a publishIt.cmd (post-build event will NOT work, b/c publish->build->postbuild->publish->build->postbuild->...).
You have to specify the path with PublishProfileFullPath to the .pubxml
file, which is stored in your [project-dir]\Properties\PublishProfiles\
-folder:
dotnet publish -p:PublishProfileFullPath=C:\Work\VeryImportantProj\Properties\PublishProfiles\FolderProfile.pubxml
Upvotes: 0
Reputation: 1
I had the same problem, and found that the solution is just to restart VS before publishing, you dont have to do anything else.
For the same reason, always publish to a new empty folder, so you can see the actual output, if any.
Upvotes: 0
Reputation: 58
I met the same problem as you, and I can't publish it successfully using either absolute path or relative path.At present, my solution is to use the command line to execute the publishing command.About publish command.
If your publish profile was named win-x64,
it just like:
dotnet publish -p:PublishProfile=win-x64
Now I seem to have found an effective way.
I’m sure this is a problem caused by the upgrade of a certain version of visual studio, Because the community version of vs can't roll back the version, I can't reproduce this Bug accurately. I use the above mentioned operations on two computers to solve this problem, and may be helpful.
Upvotes: 2