-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify build settings before build on the context of publish? #2078
Comments
* Update dependencies from https://github.com/dotnet/source-build-externals build 20240116.1 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24059.3 -> To Version 9.0.0-alpha.1.24066.1 * Update dependencies from https://github.com/dotnet/source-build-externals build 20240126.1 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24059.3 -> To Version 9.0.0-alpha.1.24076.1 * Update dependencies from https://github.com/dotnet/source-build-externals build 20240201.1 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24059.3 -> To Version 9.0.0-alpha.1.24101.1 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Jan Jones <janjones@microsoft.com>
Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label. |
The |
Please do not encourage the use of |
I'm trying to run a task that only runs on publish and that runs before Build. The goal of this task is that it will setup some properties before build gets called in the context of publish that might trigger a rebuild.
I have run into this for two scenarios so far:
I've tried to create a task with BeforeTargets="Publish" but runs after Build. I've looked at the Task and I haven't been able to figure out how to plug before build in the context of publish:
https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L41
I've also tried to redefine the publish task in my csproj file but that doesn't work given the way the SDK gets imported.
If we were to have a property PublishDependsOn would I be able to add my targets there before the Build target?
Is there a way to know the original target that was invoked (Build/Publish) so that I can distinguish that in my target?
Is there any other way to achieve this that I'm missing? (Hook up before the Build target only when publish is running to select potentially different build settings).
This is a sample of what I'm trying to accomplish (just writes an assembly metadata attribute to the assembly on publish/build.
This is what I imagine would work if there's a property for it
Any help/guidance will be appreciated.
The text was updated successfully, but these errors were encountered: