When attaching Husky via MsBuild, you can use the --ignore-submodule option within the generated target. To skip this target, set the IgnoreSubmodule variable to 0 (similar to how the HUSKY variable is used).
If you are attaching Husky manually, copy the following target block to your .csproj file and ensure you adjust the <HuskyRoot> value to the relative path from your project to the repository root.
Note: If you want the MsBuild target to run but still want the actual submodule hooks to be ignored, remove the and '$(IgnoreSubmodule)' != 0 condition from the Condition attribute of the <Target>.
<PropertyGroup>
<!-- Update this to the relative path from your project to the repo root -->
<HuskyRoot Condition="$(HuskyRoot)' == ''">../../</HuskyRoot>
</PropertyGroup>
<Target Name="Husky" AfterTargets="Restore" Condition="'$(HUSKY)' != 0 and '$(IgnoreSubmodule)' != 0"
Inputs="$(HuskyRoot).config/dotnet-tools.json"
Outputs="$(HuskyRoot).husky/_/install.stamp">
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High"/>
<Exec Command="dotnet husky install --ignore-submodule" StandardOutputImportance="Low" StandardErrorImportance="High"
WorkingDirectory="$(HuskyRoot)" />
<Touch Files="$(HuskyRoot).husky/_/install.stamp" AlwaysCreate="true"
Condition="Exists('$(HuskyRoot).husky/_')" />
<ItemGroup>
<FileWrites Include="$(HuskyRoot).husky/_/install.stamp" />
</ItemGroup>
</Target>