I'm trying to figure out how to structure a nuget package (hosted on github) in a way that it will force reference attached .dll files to the projects consuming it?
Here is a working example which I am unable to replicate on github:https://nuget.info/packages/Revit_All_Main_Versions_API_x64/2024.0.0
Here is the result I want:
And this is how someone can reffrence diffrent version dynamically:
`<ItemGroup><PackageReference Include="Revit_All_Main_Versions_API_x64" Version="2020.0.0" IncludeAssets="compile; build" PrivateAssets="all" Condition="$(Configuration.Contains('2020'))" /><PackageReference Include="Revit_All_Main_Versions_API_x64" Version="2021.0.0" IncludeAssets="compile; build" PrivateAssets="all" Condition="$(Configuration.Contains('2021'))" /><PackageReference Include="Revit_All_Main_Versions_API_x64" Version="2022.0.0" IncludeAssets="compile; build" PrivateAssets="all" Condition="$(Configuration.Contains('2022'))" /><PackageReference Include="Revit_All_Main_Versions_API_x64" Version="2023.0.0" IncludeAssets="compile; build" PrivateAssets="all" Condition="$(Configuration.Contains('2023'))" />
`Here is my solution code structure:
Here the Install.ps1 code which may be using wrong in github context:
param($installPath, $toolsPath, $package, $project)
$asm_root_folder_name = [System.IO.Path]::Combine($installPath,`"lib");
$net_folders = [System.IO.Directory]::GetDirectories(`$asm_root_folder_name, 'net*', 'TopDirectoryOnly');
$file_names = New-Object `'System.Collections.Generic.HashSet[string]';
foreach ($net in $net_folders) {
$files = [System.IO.Directory]::EnumerateFiles($net,"*.dll"`,"AllDirectories"); foreach ($file in $files) { $file_name = [System.IO.Path]::` GetFileNameWithoutExtension($file); $file_names.Add($file_name);}
}
foreach ($reference in $project.Object.References) {
if($file_names.Contains($reference.Name)) { $reference.CopyLocal = $false; $reference.SpecificVersion = $false;}
}
Can anyone help me figure out how to make my package work in the same way as the example?