Skip to content

Commit 64ad452

Browse files
committed
Only run targets when necessary and no earlier
When we add items/propeties that need to be visible to the generators, we only really need to run before the editorconfig is emitted, and no earlier. This happens right before compilation, so it's a safe late-stage target to depend on. We cannot run later since that would mean outdated info to the generator, but this should avoid early-run issues such as devlooped/GitInfo#260.
1 parent ff4e3f1 commit 64ad452

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/ThisAssembly.Constants/ThisAssembly.Constants.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</Target>
4242

4343
<Target Name="_InjectConstantAdditionalFiles"
44-
BeforeTargets="PrepareForBuild;CompileDesignTime;GenerateMSBuildEditorConfigFileShouldRun"
44+
BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun"
4545
DependsOnTargets="PrepareResourceNames;PrepareConstants">
4646
<ItemGroup>
4747
<AdditionalFiles Include="@(Constant)" SourceItemType="Constant" />

src/ThisAssembly.Project/ThisAssembly.Project.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</PropertyGroup>
1414

1515
<Target Name="InjectThisAssemblyProject" DependsOnTargets="$(InjectThisAssemblyProjectDependsOn)"
16-
BeforeTargets="PrepareForBuild;CompileDesignTime;GenerateMSBuildEditorConfigFileShouldRun">
16+
BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun">
1717
<ItemGroup>
1818
<ProjectPropertyDistinct Include="@(ProjectProperty -> Distinct())" />
1919
</ItemGroup>

src/ThisAssembly.Resources/ThisAssembly.Resources.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</ItemDefinitionGroup>
2626

2727
<Target Name="_InjectResourcesAdditionalFiles"
28-
BeforeTargets="PrepareForBuild;CompileDesignTime;GenerateMSBuildEditorConfigFileShouldRun"
28+
BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun"
2929
DependsOnTargets="PrepareResourceNames">
3030
<ItemGroup>
3131
<EmbeddedResource Condition="!$([System.IO.Path]::IsPathRooted('%(RelativeDir)')) OR '%(Link)' != ''">

src/ThisAssembly.Strings/ThisAssembly.Strings.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</ItemGroup>
88

99
<Target Name="_InjectResxAdditionalFiles"
10-
BeforeTargets="PrepareForBuild;CompileDesignTime;GenerateMSBuildEditorConfigFileShouldRun"
10+
BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun"
1111
DependsOnTargets="PrepareResourceNames">
1212
<ItemGroup>
1313
<ResxCode Include="@(EmbeddedResource)"

0 commit comments

Comments
 (0)