I'm creating NuGet packages and embedding files via targets file as follow;
<ItemGroup><ReferencePath Condition="'%(ReferencePath.NuGetPackageId)' == 'packageName' AND '%(Extension)' == '.dll'"><EmbeddedFiles>true</EmbeddedFiles></ReferencePath></ItemGroup>
The code above works fine if the references are declare in the .nuspec file but I would like to embedded a file that is not mark as reference in my .nuspec.This is what I'm trying to do so far
<ItemGroup Condition="$(Platform)=='x86'"><EmbeddedResource Include="$(MSBuildThisFileDirectory)\..\lib\net48\x86\Sample.dll"/></ItemGroup><ItemGroup Condition="$(Platform)=='x64'"><EmbeddedResource Include="$(MSBuildThisFileDirectory)\..\lib\net48\x64\Sample.dll"/></ItemGroup><ItemGroup><Reference Include="Sample.dll" Condition="'$(Platform)' == 'x86'"><HintPath>$(MSBuildThisFileDirectory)\..\lib\net48\x86\Sample.dll</HintPath></Reference><Reference Include="Sample.dll" Condition="'$(Platform)' == 'x64'"><HintPath>$(MSBuildThisFileDirectory)\..\lib\net48\x64\Sample.dll</HintPath></Reference></ItemGroup>
That works properly to add the reference by installing using package.config but not PackageReference because the dll is not being embedded.
How can I specify via targets file to embedded and add a reference to a file?