From c50a0e000ab1812ec4781ace349a5d84fa01c8e4 Mon Sep 17 00:00:00 2001
From: Sean Hall <r.sean.hall@gmail.com>
Date: Wed, 24 Jun 2020 14:23:51 +1000
Subject: Merge the native nupkg into the Core.Native nupkg.

There was no benefit in separating the native assets into its own package, the runtime.<rid>.PackageName strategy is for binaries to be copied to the root of project and therefore doesn't support the portable scenario where all available assets are required.

Manually author the repository element in the nupkg for SourceLink.
---
 .../WixToolset.Core.Native.csproj                  | 30 ++++++++++++++--------
 .../WixToolset.Core.Native.nuspec                  | 25 ++++++++----------
 .../WixToolsetTest.Core.Native.csproj              |  5 ++--
 .../runtime.win.WixToolset.Core.Native.nuspec      | 24 -----------------
 src/wixnative/wixnative.vcxproj                    | 13 ----------
 5 files changed, 33 insertions(+), 64 deletions(-)
 delete mode 100644 src/wixnative/runtime.win.WixToolset.Core.Native.nuspec

(limited to 'src')

diff --git a/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj b/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj
index ca8797a9..d12d0da6 100644
--- a/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj
+++ b/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj
@@ -5,9 +5,19 @@
     <NuspecFile>$(MSBuildThisFileName).nuspec</NuspecFile>
     <Description>Core Native</Description>
     <DebugType>embedded</DebugType>
-    <!-- <BeforePack>SetNuspecProperties</BeforePack> -->
   </PropertyGroup>
 
+  <ItemGroup>
+    <ProjectReference Include="..\wixnative\wixnative.vcxproj">
+      <PrivateAssets>All</PrivateAssets>
+      <Properties>Platform=Win32</Properties>
+    </ProjectReference>
+    <ProjectReference Include="..\wixnative\wixnative.vcxproj">
+      <PrivateAssets>All</PrivateAssets>
+      <Properties>Platform=x64</Properties>
+    </ProjectReference>
+  </ItemGroup>
+
   <ItemGroup>
     <PackageReference Include="WixToolset.Data" Version="4.0.*" PrivateAssets="All" />
   </ItemGroup>
@@ -20,16 +30,16 @@
   <PropertyGroup>
     <NativeFileListPath Condition=" '$(NCrunch)'=='' ">$(MSBuildProjectDir)..\..\build\obj\$(ProjectName)\$(Configuration)\NativeFileList.txt</NativeFileListPath>
     <NativeFileListPath Condition=" '$(NCrunch)'=='1' ">$(NCrunchOriginalProjectDir)..\..\build\obj\$(ProjectName)\$(Configuration)\NativeFileList.txt</NativeFileListPath>
+    <MergeModDirectory>$(MSBuildThisFileDirectory)..\wixnative\</MergeModDirectory>
   </PropertyGroup>
 
   <Target Name="BuildWixNative" BeforeTargets="GetCopyToOutputDirectoryItems" Condition=" '$(NCrunch)'=='' ">
-    <MSBuild Projects="..\wixnative\wixnative.vcxproj" Properties="Platform=Win32" Targets="Build;BuiltProjectOutputGroup;ContentFilesProjectOutputGroup;DebugSymbolsProjectOutputGroup">
-      <Output TaskParameter="TargetOutputs" ItemName="_NativeProjectOutput" />
-    </MSBuild>
-    <MSBuild Projects="..\wixnative\wixnative.vcxproj" Properties="Platform=x64" Targets="Build;BuiltProjectOutputGroup;ContentFilesProjectOutputGroup;DebugSymbolsProjectOutputGroup">
-      <Output TaskParameter="TargetOutputs" ItemName="_NativeProjectOutput" />
-    </MSBuild>
-      
+    <ItemGroup>
+      <_NativeProjectOutput Include="$(MergeModDirectory)x64\mergemod.dll" />
+      <_NativeProjectOutput Include="$(OutputPath)..\x64\wixnative.exe" />
+      <_NativeProjectOutput Include="$(OutputPath)..\x64\wixnative.pdb" />
+    </ItemGroup>
+
     <WriteLinesToFile File="$(NativeFileListPath)" Lines="@(_NativeProjectOutput)" Overwrite="true" />
 
     <ItemGroup>
@@ -60,8 +70,8 @@
 
   <Target Name="SetNuspecProperties" AfterTargets="CoreBuild">
     <PropertyGroup>
-      <NuspecBasePath>$(OutputPath)</NuspecBasePath>
-      <NuspecProperties>Configuration=$(Configuration);Id=$(MSBuildThisFileName);Version=$(BuildVersionSimple);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description)</NuspecProperties>
+      <NuspecBasePath>$(OutputPath)..\</NuspecBasePath>
+      <NuspecProperties>Id=$(MSBuildThisFileName);Version=$(BuildVersionSimple);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description);RepositoryCommit=$(SourceRevisionId);RepositoryType=$(RepositoryType);RepositoryUrl=$(PrivateRepositoryUrl);MergeModDir=$(MergeModDirectory)</NuspecProperties>
     </PropertyGroup>
   </Target>
 </Project>
diff --git a/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec b/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec
index 1ff5538b..e862b1ba 100644
--- a/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec
+++ b/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec
@@ -5,30 +5,25 @@
     <version>$version$</version>
     <authors>$authors$</authors>
     <owners>$authors$</owners>
-    <!-- <license type="expression">MS-RL</license> -->
-    <licenseUrl>https://licenses.nuget.org/MS-RL</licenseUrl>
+    <license type="expression">MS-RL</license>
     <projectUrl>https://github.com/wixtoolset/Core.Native</projectUrl>
     <requireLicenseAcceptance>false</requireLicenseAcceptance>
     <description>$description$</description>
     <copyright>$copyright$</copyright>
-
+    <repository type="$repositorytype$" url="$repositoryurl$" commit="$repositorycommit$" />
     <dependencies>
-      <dependency id="runtime.win.WixToolset.Core.Native" version="$version$" />
-<!--
-      <dependency id="runtime.win-x86.WixToolset.Core.Native" version="$version$" />
-      <dependency id="runtime.win-x64.WixToolset.Core.Native" version="$version$" />
--->
+      <group targetFramework=".NETStandard2.0" />
     </dependencies>
   </metadata>
 
   <files>
-    <file src="$id$.dll" target="lib\netstandard2.0" />
+    <file src="netstandard2.0\$id$.dll" target="lib\netstandard2.0" />
 
-    <!--
-    <file src="..\Win32\wixnative.x86.exe" target="lib\netstandard2.0" />
-    <file src="..\Win32\wixnative.x86.pdb" target="lib\netstandard2.0" />
-    <file src="..\x64\wixnative.amd64.exe" target="lib\netstandard2.0" />
-    <file src="..\x64\wixnative.amd64.pdb" target="lib\netstandard2.0" />
-     -->
+    <file src="$mergemoddir$Win32\mergemod.dll" target="runtimes\win-x86\native" />
+    <file src="Win32\wixnative.exe" target="runtimes\win-x86\native" />
+    <file src="Win32\wixnative.pdb" target="runtimes\win-x86\native" />
+    <file src="$mergemoddir$x64\mergemod.dll" target="runtimes\win-x64\native" />
+    <file src="x64\wixnative.exe" target="runtimes\win-x64\native" />
+    <file src="x64\wixnative.pdb" target="runtimes\win-x64\native" />
   </files>
 </package>
diff --git a/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj b/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj
index 14928112..9c493d84 100644
--- a/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj
+++ b/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj
@@ -3,8 +3,9 @@
 
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.1</TargetFramework>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
     <IsPackable>false</IsPackable>
+    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
   </PropertyGroup>
 
   <ItemGroup>
@@ -21,7 +22,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
     <PackageReference Include="xunit" Version="2.4.1" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />
   </ItemGroup>
diff --git a/src/wixnative/runtime.win.WixToolset.Core.Native.nuspec b/src/wixnative/runtime.win.WixToolset.Core.Native.nuspec
deleted file mode 100644
index a775b570..00000000
--- a/src/wixnative/runtime.win.WixToolset.Core.Native.nuspec
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
-  <metadata minClientVersion="4.0">
-    <id>$id$</id>
-    <version>$version$</version>
-    <authors>$authors$</authors>
-    <owners>$authors$</owners>
-    <!-- <license type="expression">MS-RL</license> -->
-    <licenseUrl>https://licenses.nuget.org/MS-RL</licenseUrl>
-    <projectUrl>https://github.com/wixtoolset/Core.Native</projectUrl>
-    <requireLicenseAcceptance>false</requireLicenseAcceptance>
-    <description>$description$</description>
-    <copyright>$copyright$</copyright>
-  </metadata>
-
-  <files>
-    <file src="Win32\mergemod.dll" target="runtimes\win-x86\native" />
-    <file src="Win32\wixnative.exe" target="runtimes\win-x86\native" />
-    <file src="Win32\wixnative.pdb" target="runtimes\win-x86\native" />
-    <file src="x64\mergemod.dll" target="runtimes\win-x64\native" />
-    <file src="x64\wixnative.exe" target="runtimes\win-x64\native" />
-    <file src="x64\wixnative.pdb" target="runtimes\win-x64\native" />
-  </files>
-</package>
diff --git a/src/wixnative/wixnative.vcxproj b/src/wixnative/wixnative.vcxproj
index 5927c14c..e53af651 100644
--- a/src/wixnative/wixnative.vcxproj
+++ b/src/wixnative/wixnative.vcxproj
@@ -30,7 +30,6 @@
     <TargetName>wixnative</TargetName>
     <PlatformToolset>v141</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
-    <Description>Native component of WixToolset.Core</Description>
   </PropertyGroup>
 
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@@ -69,18 +68,6 @@
     <None Include="packages.config" />
   </ItemGroup>
 
-  <ItemGroup>
-    <None Include="$(Platform)\mergemod.dll">
-      <DeploymentContent>true</DeploymentContent>
-      <Link>%(Filename)%(Extension)</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
-  </ItemGroup>
-
-  <Target Name="Pack" DependsOnTargets="GetBuildVersion">
-    <Exec Command='nuget pack runtime.win.WixToolset.Core.Native.nuspec -BasePath "$(BaseOutputPath)$(Configuration)" -OutputDirectory "$(BaseOutputPath)$(Configuration)" -NoPackageAnalysis -Properties Configuration=$(Configuration);Id=runtime.win.WixToolset.Core.Native;Version="$(BuildVersionSimple)";Platform=$(PlatformTarget);Authors="$(Authors)";Copyright="$(Copyright)";Description="$(Description)";Title="$(Title)"' />
-  </Target>
-
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
-- 
cgit v1.2.3-55-g6feb