question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"AfterPublish" doesn't invoked

See original GitHub issue

Describe the bug

image

ASP.Net Core project

image

To Reproduce

  1. download the Avalonia Gallery
  2. create a task that depends on “AfterPublish” task
  3. dotnet publish
  4. “AfterPublish” and custom task doesn’t not invoked
  5. if it is a ASP.Net Core project, “AfterPublish” does be invoked.

Exceptions (if any)

both of the two tasks should be invoked

Further technical details

sdk: 6.0.300

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
liesauercommented, Oct 7, 2022

In the current version (SDK 6.0.401) the only way to get a single file app on the desktop is through publish. If you then want access to that final EXE in an automation, you need an AfterPublish event. I was unable to get this working, I found this issue. Seems to be the same. Being able to publish to a single file is a huge reason why I’m upgrading my desktop projects from Framework. As we go through this process of migrating away from Framework we are all going to need this feature on the Desktop.

the last stage of non-web project is Publish, so for now, the following workaround works for me.

<PropertyGroup>
    <_TaskDependsOn Condition="'$(_IsAspNetCoreProject)' == 'true'">AfterPublish</_TaskDependsOn>
    <_TaskDependsOn Condition="'$(_IsAspNetCoreProject)' != 'true'">Publish</_TaskDependsOn>
</PropertyGroup>

<Target Name="CustomTask" AfterTargets="$(_TaskDependsOn)">
    <Message Text="Hello" Importance="High" />
</Target>
1reaction
baronfelcommented, Oct 6, 2022

This one slipped through the cracks - I’ve added it to our triage bucket for discussion. As I stated above, I definitely believe that we need to do this work to enable consistent publish behavior for all project types, not just web projects. We’ll also need to consult with @vijayrkn and his team to make sure the VS/Web publish behavior isn’t impacted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AfterPublish target not working - msbuild
AfterPublish is called after Publish target, but Publish is not the target called when you publish a web application. Publish is the target...
Read more >
Is there any msbuild target that is executed after publishing ...
I need to execute a command after publishing a .NET core WPF app in Visual Studio. I tried following custom target in .csproj...
Read more >
[Solved]-AfterPublish script doesn't run when I publish a web ...
Coding example for the question AfterPublish script doesn't run when I publish a web ... invoke-command -scriptblock { &&apos;$(ScriptLocation)&apos; ...
Read more >
workflow cannot be found. make sure that it is part of the ...
hello, I'm trying to invoke a workflow from a shared folder. it is giving me an error “workflow cannot be found. Make sure...
Read more >
After Publish to machine with self signed certificate
If we publish a Asp.Net webproject to our development IIS Server which has an self signed certificate an message appears that you have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found