jaredpar / basic-reference-assemblies

Produce NuPkg files that have .NET Reference assemblies as resources
MIT License
96 stars 15 forks source link

Add Net6.0Windows project #30

Closed jairbubbles closed 1 year ago

jairbubbles commented 1 year ago

Add new package Basic.Reference.Assemblies.Net60Windows that contains all reference assemblies from https://www.nuget.org/packages/Microsoft.WindowsDesktop.App.Ref/6.0.10.

jaredpar commented 1 year ago

This looks very reasonable. One item you're missing in this PR is publishing the new package. Need to update this YML file to have a publish step

https://github.com/jaredpar/basic-reference-assemblies/blob/main/.github/workflows/publish.yml#L34

jairbubbles commented 1 year ago

This looks very reasonable. One item you're missing in this PR is publishing the new package. Need to update this YML file to have a publish step

https://github.com/jaredpar/basic-reference-assemblies/blob/main/.github/workflows/publish.yml#L34

Change done!

Please note that for my use case, I needed the assemblies as files on the local disk. Rather than saving them to disk from resources, I'm finally applying the same technique but directly in my application in a CopyReferenceAssemblies.targets:

<!-- .target to include in projects (.exe or unit tests) that will need to compile scripts.
 It will copy reference assemblies in ReferenceAssemblies/ sub-directory -->
<Project>
  <!-- .NET Framework 4.7.2: copy all reference .dll (including facades) from Microsoft.NETFramework.ReferenceAssemblies.net472 package -->
  <ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
    <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.3" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />

    <None Include="$(PkgMicrosoft_NETFramework_ReferenceAssemblies_net472)\build\.NETFramework\v4.7.2\*.dll;$(PkgMicrosoft_NETFramework_ReferenceAssemblies_net472)\build\.NETFramework\v4.7.2\Facades\*.dll"
          Exclude="$(PkgMicrosoft_NETFramework_ReferenceAssemblies_net472)\build\.NETFramework\v4.7.2\System.Enterprise*" >
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Link>ReferenceAssemblies\%(Filename)%(Extension)</Link>
    </None>
  </ItemGroup>

  <!-- .NET 6.0: Copy all reference .dll from Microsoft.NetCore.App.Ref package -->
  <ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
    <PackageReference Include="Microsoft.NetCore.App.Ref" Version="6.0.9" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />

    <None Include="$(PkgMicrosoft_NetCore_App_Ref)\ref\net6.0\*.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Link>ReferenceAssemblies\%(Filename)%(Extension)</Link>
    </None>
  </ItemGroup>

  <!-- .NET 6.0 (Windows): Copy all reference .dll from Microsoft.NetCore.App.Ref and Microsoft.WindowsDesktop.App.Ref packages -->
  <ItemGroup Condition=" '$(TargetFramework)' == 'net6.0-windows' ">
    <PackageReference Include="Microsoft.NetCore.App.Ref" Version="6.0.9" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />
    <PackageReference Include="Microsoft.WindowsDesktop.App.Ref" Version="6.0.9" IncludeAssets="none" PrivateAssets="all" GeneratePathProperty="true" />

    <None Include="$(PkgMicrosoft_NetCore_App_Ref)\ref\net6.0\*.dll;$(PkgMicrosoft_WindowsDesktop_App_Ref)\ref\net6.0\*.dll"
          Exclude="$(PkgMicrosoft_NetCore_App_Ref)\ref\net6.0\WindowsBase.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Link>ReferenceAssemblies\%(Filename)%(Extension)</Link>
    </None>
  </ItemGroup>

</Project>

Thx a lot for sharing your ideas!

jaredpar commented 1 year ago

thanks!