0

enter image description here

I know when I Click 'Rebuild Solution'. it is something like below.

[msbuild C:\Users\Micheal\source\repos\Calculator\Calculator.sln -t:publish]

enter image description here

enter image description here

But I do not know what exact publish command is.

I guess it is [msbuild C:\Users\dkssu\source\repos\Calculator\Calculator.sln -t:publish] But it is wrong. It just built and did not go further.

Here's my question. How to intercept commands when I click something in visual studio (2017/2019)

Micheal
  • 23
  • 5
  • Can you clarify what you meant by "did not go further" - further to what? Based only on your screenshot, you have a _folder_ profile/target. So it will _publish_ the _compiled_ assets to said folder, based on the settings you defined. – EdSF Jan 05 '21 at 15:18
  • Hi, any update about this issue? Please check if my answer helps you handle the issue and let us know any feedback. – Mr Qian Jan 13 '21 at 02:43
  • @Micheal, Please check if it helps you handle your issue. If it helps, please do not forget to [accept it](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work). And if not, please feel free to let us know:) – Mr Qian Jan 18 '21 at 06:07

1 Answers1

4

Actually, the command is different and you should note that -t:publish which only works for the publish of windows app projects.

For asp net web projects, you should use PublishProfile file which is a publish guidance file.

Use this:

msbuild xxx\xxx.sln /p:DeployOnBuild=true /p:PublishProfile=xxx\xxx\PublishProfiles\FolderProfile.pubxml

Although -t:publish can work on asp net web projects successfully, in fact, it does not play any function. After all, the command is for windows app publish.

For windows app projects, it actually publish the project and it just doesn't show up in the default MSBuild log.

You should additionally use -v:detailed command to check the detailed log.

msbuild xxx\xxx.sln -t:publish -v:detailed

And when you finish the command, you can check under the build output folder(bin\xxx), it actually there.

enter image description here

Mr Qian
  • 21,064
  • 1
  • 31
  • 41