ByronMayne / AutoFactories

AutoFactories is a C# library used to generate factories for types to be used in dependency injection.
MIT License
1 stars 0 forks source link

Templates fail to generate if you don't reference `AutoFactories` NuGet package #32

Closed ByronMayne closed 3 hours ago

ByronMayne commented 3 hours ago

If you have a project that is setup like below:

<Project>
  <ItemGroup>
    <PackageReference Include="AutoFactories.Ninject"/>
    <!-- Uncommenting Below fix the Issue -->
    <!-- <PackageReference Include="AutoFactories"/> -->
  </ItemGroup>
</Project>

The templates will fail to generate because the views could not be found. The views that are missing are found in AutoFactories. This should work but it does not.

ByronMayne commented 3 hours ago

The issue is the AutoFactories.build.props and AutoFactories.build.targets only get imported if you make a direct reference. This is why adding a reference fixes it. The fix for the issue was to change the build scripts from the /build to the /buildTransitive folder and it all works correctly.

https://github.com/NuGet/Home/wiki/Allow-package--authors-to-define-build-assets-transitive-behavior