dotnet / dotnet/sdk

Consider running Publish target when `_IsPublishing` is true

Open
#46,279 3 comments 0 reactions 1 assignee Claimed by @dsplaisted View on GitHub
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

For folks who don't use `dotnet publish`, it's a common pattern to inject the `Publish` target so that they can run `msbuild` without specifying `/t:Publish`. See examples from https://github.com/dotnet/sdk/pull/37872#issuecomment-2606331646:

> Lots of people do that, [some of them](https://github.com/search?q=_IsPublishing+language%3AXML&type=code&l=XML) even pass _IsPublishing but most of them just do some variation of "run the Publish target". [Here](https://github.com/microsoft/react-native-windows/blob/953372ac95154d9e9a3f071096c6df856ddc32e2/vnext/Microsoft.ReactNative.Managed.CodeGen/Microsoft.ReactNative.Managed.CodeGen.csproj#L65-L73) [is](https://github.com/bytecodealliance/componentize-dotnet/blob/f09f70343ba1a40599f4d517d1aa76fe67ac1d95/src/WasmComponent.Sdk/build/BytecodeAlliance.Componentize.DotNet.Wasm.SDK.targets#L5) a [popular](https://github.com/Azure/azure-sdk-for-media-services/blob/58b04ba58d54a33aaaad884a150237ac6965cabd/build/Azure%20SDK/v1.6/ImportAfter/AzureDeploy.targets#L6) [pattern](https://github.com/deutschebank/plexus-interop/blob/66ba7daa0781cc339abfed25717ecf9a3ccc43de/desktop/src/Plexus.Host/Plexus.Host.csproj#L59) (note these are all pretty high profile).

This won't fully replicate the effects of `dotnet publish` unless they also pass `-p:_IsPublishing=true`. Would it make sense to run the Publish target after Build when `_IsPublishing` is set, so that folks using msbuild can at least do `msbuild -p:_IsPublishing=true` and get the same output as `dotnet publish`? (We wouldn't advertise that until it's made public, see https://github.com/dotnet/sdk/issues/26324)

@MichalStrehovsky @rainersigwald @marcpopMSFT @dsplaisted @agocke

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.