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.

dotnet publish does not package like DeployOnBuild=true does for SDK-style project

See original GitHub issue

Please provide a succinct description of the issue.

Repro steps

  1. Create a new SDK-style webjobs project with webjob properties set. i.e.:
    <IsWebJobProject>true</IsWebJobProject>
    <WebJobName>MyWebJob</WebJobName>
    <WebJobType>Continuous</WebJobType>
  1. Run dotnet publish

Expected behavior

The web job is packaged into the correct structure: app_data\Jobs\Continuous\MyWebJob\...

Actual behavior

The web job is not packaged into the correct structure. It is only possible to get the correct structure via dotnet build -p:DeployOnBuild=true. This means you do not have support for things like dotnet publish --no-build. In fact I do not know a way to package a webjob without triggering the build target. This makes it very difficult to split the build & package steps into two distinct msbuild calls (to differentiate them on CI machines, and to allow for non-msbuild operations to happen between build and publish - such as signing).

Known workarounds

It is not even possible to chain dotnet publish into the web job package flow as target _CopyWebJobFilesToIntermediateOutputPath depends on Publish, so it results in circular references (as Publish target will be your entry). At least I could not find a way to make this work. The only alternative is to define another Target as such:

  <Target Name="Package" DependsOnTargets="$(DotNetPublishDependsOn)" />

Then you can run dotnet msbuild /t:Package and adding /p:NoBuild=true to skip the build. But this does not allow for the use of the dotnet publish commands.

Related information

Provide any related information

  • This is not using Microsoft.Web.WebJobs.Publish, but Microsoft.NET.Sdk.Publish
  • Using .netcore sdk 2.2.106

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vijayrkncommented, Aug 3, 2020

This should be fixed in functions sdk 3.0.9

1reaction
brettsamcommented, Sep 10, 2019

@fabiocav / @mathewc – is this where we track issues with WebJobs builds? I’m not sure where the tooling for this lives…

Read more comments on GitHub >

github_iconTop Results From Across the Web

net core - dotnet publish Not Deploying
I am trying to execute a Web Deploy on my .NET Core 2.0 Project. Deploying manually from within Visual Studio's "Publish" feature works...
Read more >
MSBuild reference for .NET SDK projects
The IsPublishable property allows the Publish target to run. This property only affects processes that use .*proj files and the Publish target, ...
Read more >
dotnet publish command - .NET CLI
The dotnet publish command publishes a .NET project or solution to a directory.
Read more >
NET application publishing overview
Learn about the ways to publish a .NET application. .NET can publish platform-specific or cross-platform apps. You can publish an app as ......
Read more >
Managing Dependencies in .NET: .csproj, .packages.config ...
Get an overview of the artifacts involved in .NET dependency management, how they interact, and how to use them.
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