dotnet publish does not package like DeployOnBuild=true does for SDK-style project
See original GitHub issuePlease provide a succinct description of the issue.
Repro steps
- Create a new SDK-style webjobs project with webjob properties set. i.e.:
<IsWebJobProject>true</IsWebJobProject>
<WebJobName>MyWebJob</WebJobName>
<WebJobType>Continuous</WebJobType>
- 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
, butMicrosoft.NET.Sdk.Publish
- Using .netcore sdk 2.2.106
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top GitHub Comments
This should be fixed in functions sdk 3.0.9
@fabiocav / @mathewc – is this where we track issues with WebJobs builds? I’m not sure where the tooling for this lives…