Skip to content

Commit e26dfe8

Browse files
committed
use tasks from the built assembly during packing instead of from the project asset package
1 parent b35b135 commit e26dfe8

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2022 smdn <smdn@smdn.jp>
3+
SPDX-License-Identifier: MIT
4+
-->
5+
<Project>
6+
<ImportGroup>
7+
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.targets" />
8+
<Import Project="$(MSBuildThisFileDirectory)UsingExportedTasks.targets" />
9+
</ImportGroup>
10+
</Project>

src/Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks/Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ SPDX-License-Identifier: MIT
4040
<ItemGroup>
4141
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.0.0" PrivateAssets="All" />
4242
<ProjectReference VersionRange="[1.1.0,2.0.0)" Include="..\Smdn.Reflection.ReverseGenerating.ListApi.Core\Smdn.Reflection.ReverseGenerating.ListApi.Core.csproj" PrivateAssets="All" />
43+
44+
<!-- remove this package itself from PackageReference to avoid duplicate references during the running of 'Pack' target -->
45+
<PackageReference Remove="$(PackageId)" />
4346
</ItemGroup>
4447

4548
<ItemGroup Label="exporting tasks">
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2022 smdn <smdn@smdn.jp>
3+
SPDX-License-Identifier: MIT
4+
-->
5+
<Project>
6+
<!-- use exported tasks from the built assembly instead of from the project asset package -->
7+
<PropertyGroup>
8+
<UseExportedTasksFromOutputAssembly>true</UseExportedTasksFromOutputAssembly>
9+
<UsingTaskAssemblyFileConfiguration>Release</UsingTaskAssemblyFileConfiguration>
10+
<UsingTaskAssemblyFileTargetFramework>net6.0</UsingTaskAssemblyFileTargetFramework>
11+
</PropertyGroup>
12+
13+
<UsingTask
14+
Condition="'$(UseExportedTasksFromOutputAssembly)' == 'true'"
15+
TaskName="@(ExportTaskNames->'%(Namespace).%(Identity)', ';')"
16+
AssemblyFile="$(BaseOutputPath)$(UsingTaskAssemblyFileConfiguration)\$(UsingTaskAssemblyFileTargetFramework)\$(AssemblyName).dll"
17+
/>
18+
</Project>

0 commit comments

Comments
 (0)