Search code examples
c#globcsprojdotnet-sdk

Is there a way to use globbing for the new CS Project format when it comes to references?


I created a C# project with the new NetSDK format. Globbing works with other situations:

<ItemGroup>
  <None Include="Miscellaneous\*.misc" CopyToOutputDirectory="Always" />
</ItemGroup>

However, globbing does not seem to work with the Reference tag:

<ItemGroup>
  <!-- THIS DOES NOT WORK -->
  <Reference Include="Company.Misc.*" HintPath="bin\Company.Misc.*.dll" />

  <!-- THIS DOES WORK -->
  <Reference Include="Company.Misc.A" HintPath="bin\Company.Misc.A.dll" />
  <Reference Include="Company.Misc.B" HintPath="bin\Company.Misc.B.dll" />
</ItemGroup>

Not sure if there is a way to automatically pull in all items from the bin\ directory as a Reference so it shows up under 'Dependencies'?


Solution

  • Apparently this wasn't hard, I had to ignore the hint path stuff and just point to the assemblies directly: <Reference Include="bin\Company.Misc.*" />. The Visual Studio solution explorer window will automatically reflect the name (not the path) of the assembly if you supply the full path in the include.