diff --git a/docs/guide/automate.md b/docs/guide/automate.md index f61a05c..d2eedad 100644 --- a/docs/guide/automate.md +++ b/docs/guide/automate.md @@ -25,7 +25,7 @@ You can set the `HUSKY` environment variable to `0` in order to disable husky in To manually attach husky to your project, add the below code to one of your projects (*.csproj/*.vbproj). ``` xml:no-line-numbers:no-v-pre - @@ -59,7 +59,7 @@ to avoid this, you can add the `$(IsCrossTargetingBuild)' == 'true'` condition t e.g ``` xml:no-line-numbers:no-v-pre - + ... ``` diff --git a/docs/guide/submodules.md b/docs/guide/submodules.md index 776f191..20070d4 100644 --- a/docs/guide/submodules.md +++ b/docs/guide/submodules.md @@ -34,7 +34,7 @@ The `attach` command offers a `--ignore-submodule` options that generates an MsB The generated block will look something like this, If you're attaching husky manually copy the target to your `.csproj` and adjust `WorkingDirectory` accordingly. ```xml:no-line-numbers:no-v-pre - + diff --git a/src/Husky/Cli/AttachCommand.cs b/src/Husky/Cli/AttachCommand.cs index 1dc6723..fc1f25f 100644 --- a/src/Husky/Cli/AttachCommand.cs +++ b/src/Husky/Cli/AttachCommand.cs @@ -67,7 +67,7 @@ private XElement GetTarget(string condition, string rootRelativePath) var target = new XElement("Target"); target.SetAttributeValue("Name", "Husky"); - target.SetAttributeValue("BeforeTargets", "Restore;CollectPackageReferences"); + target.SetAttributeValue("AfterTargets", "Restore"); target.SetAttributeValue("Condition", condition); target.SetAttributeValue("Inputs", inputPath); target.SetAttributeValue("Outputs", sentinelPath); diff --git a/tests/HuskyTest/Cli/AttachCommandTests.cs b/tests/HuskyTest/Cli/AttachCommandTests.cs index b3f11d7..e460df8 100644 --- a/tests/HuskyTest/Cli/AttachCommandTests.cs +++ b/tests/HuskyTest/Cli/AttachCommandTests.cs @@ -66,6 +66,9 @@ public async Task Attach_WhenParametersProvided_ShouldAddHuskyTargetElement() huskyTarget.Descendants("ItemGroup").Descendants("FileWrites").Should().HaveCount(1); _console.ReadOutputString().Trim().Should().Be("Husky dev-dependency successfully attached to this project."); + + huskyTarget.Attribute("AfterTargets")?.Value.Should().Be("Restore"); + huskyTarget.Attribute("BeforeTargets").Should().BeNull(); } [Fact]