Last active
December 30, 2023 19:48
-
-
Save dasMulli/b14026437468ce4b56ef93e010f24a36 to your computer and use it in GitHub Desktop.
PublishAll target to publish for all frameworks and runtimes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project> | |
<Target Name="PublishProjectIfFrameworkSet" | |
DependsOnTargets="Publish" | |
Condition=" '$(TargetFramework)' != '' " /> | |
<Target Name="PublishProjectForAllRIDsIfTargetFrameworkSet" Condition=" '$(TargetFramework)' != '' and '$(RuntimeIdentifiers)' != '' and '$(RuntimeIdentifier)' == '' "> | |
<ItemGroup> | |
<_PublishRuntimeIdentifier Include="$(RuntimeIdentifiers)" /> | |
</ItemGroup> | |
<MSBuild Projects="$(MSBuildProjectFile)" Targets="PublishAll" Properties="TargetFramework=$(TargetFramework);RuntimeIdentifier=%(_PublishRuntimeIdentifier.Identity)" /> | |
</Target> | |
<Target Name="PublishProjectForAllFrameworksIfFrameworkUnset" Condition=" '$(TargetFramework)' == '' "> | |
<ItemGroup> | |
<_PublishFramework Include="$(TargetFrameworks)" /> | |
</ItemGroup> | |
<MSBuild Projects="$(MSBuildProjectFile)" Targets="PublishAll" Properties="TargetFramework=%(_PublishFramework.Identity)" /> | |
</Target> | |
<Target Name="PublishAll" | |
DependsOnTargets="PublishProjectIfFrameworkSet;PublishProjectForAllRIDsIfTargetFrameworkSet;PublishProjectForAllFrameworksIfFrameworkUnset" /> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment