From 2a10e6fe1d3bc26bfffb5cf8fa971d780ed67579 Mon Sep 17 00:00:00 2001
From: Ajay Bhargav Baaskaran <ajbaaska@microsoft.com>
Date: Thu, 19 Apr 2018 10:45:39 -0700
Subject: [PATCH] Added nuspec file for Mvc.Razor.ViewCompilation to include
 symbols

---
 ...spNetCore.Mvc.Razor.ViewCompilation.csproj | 46 ++++++++++++++-----
 ...spNetCore.Mvc.Razor.ViewCompilation.nuspec | 38 +++++++++++++++
 2 files changed, 72 insertions(+), 12 deletions(-)
 create mode 100644 src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.nuspec

diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj
index 1e3cfcb256d..bf7f0b000d7 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj
+++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj
@@ -3,7 +3,6 @@
   <PropertyGroup>
     <Description>Build-time references required to enable Razor view compilation as part of building the application.</Description>
     <TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
-    <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
 
     <PackageTags>cshtml;razor;compilation;precompilation;aspnetcore</PackageTags>
     <PreserveCompilationContext>true</PreserveCompilationContext>
@@ -11,6 +10,7 @@
     <TasksProjectDirectory>..\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\</TasksProjectDirectory>
     <IncludeBuildOutput>false</IncludeBuildOutput>
     <EnableApiCheck>false</EnableApiCheck>
+    <NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(TargetFramework)'=='net461'">
@@ -31,17 +31,6 @@
     <PackageReference Update="Microsoft.NETCore.App" PrivateAssets="All" />
   </ItemGroup>
 
-  <ItemGroup>
-    <None Include="build\**\*.*" Pack="true" PackagePath="%(Identity)" />
-    <None Include="$(OutputPath)netcoreapp2.0\$(AssemblyName).dll" Pack="true" PackagePath="build\netstandard2.0\$(AssemblyName).dll" />
-    <None Include="$(TasksProjectDirectory)bin\$(Configuration)\netstandard2.0\$(AssemblyName).Tasks.dll" Pack="true" PackagePath="build\netstandard2.0\$(AssemblyName).Tasks.dll" />
-  </ItemGroup>
-
-  <ItemGroup Condition="'$(OS)'=='Windows_NT'">
-    <None Include="$(OutputPath)net461\win7-x86\$(AssemblyName)-x86.exe" Pack="true" PackagePath="build\netstandard2.0\" />
-    <None Include="$(OutputPath)net461\win7-x64\$(AssemblyName)-x64.exe" Pack="true" PackagePath="build\netstandard2.0\" />
-  </ItemGroup>
-
   <Target Name="BuildX64" AfterTargets="Build" Condition="'$(TargetFramework)'=='net461' AND '$(PlatformTarget)'!='x64'">
     <MSBuild
       Projects="$(MSBuildProjectFullPath)"
@@ -51,4 +40,37 @@
         TargetFramework=net461;
         Platform=x64;" />
   </Target>
+
+  <Target Name="PopulateNuspec" BeforeTargets="GenerateNuspec" DependsOnTargets="BuildX64;">
+
+    <PropertyGroup>
+      <!-- Make sure we create a symbols.nupkg. -->
+      <IncludeSymbols>true</IncludeSymbols>
+
+      <NuspecProperties>
+        id=$(PackageId);
+        version=$(PackageVersion);
+        authors=$(Authors);
+        description=$(Description);
+        tags=$(PackageTags.Replace(';', ' '));
+        licenseUrl=$(PackageLicenseUrl);
+        projectUrl=$(PackageProjectUrl);
+        iconUrl=$(PackageIconUrl);
+        repositoryUrl=$(RepositoryUrl);
+        repositoryCommit=$(RepositoryCommit);
+        copyright=$(Copyright);
+        AssemblyName=$(AssemblyName);
+
+        OutputBinary=$(OutputPath)netcoreapp2.0\$(AssemblyName).dll;
+        OutputSymbol=$(OutputPath)netcoreapp2.0\$(AssemblyName).pdb;
+        TaskBinary=$(TasksProjectDirectory)bin\$(Configuration)\netstandard2.0\$(AssemblyName).Tasks.dll;
+        TaskSymbol=$(TasksProjectDirectory)bin\$(Configuration)\netstandard2.0\$(AssemblyName).Tasks.pdb;
+
+        OutputExeX86=$(OutputPath)net461\win7-x86\$(AssemblyName)-x86.exe;
+        OutputExeSymbolX86=$(OutputPath)net461\win7-x86\$(AssemblyName)-x86.pdb;
+        OutputExeX64=$(OutputPath)net461\win7-x64\$(AssemblyName)-x64.exe;
+        OutputExeSymbolX64=$(OutputPath)net461\win7-x64\$(AssemblyName)-x64.pdb;
+      </NuspecProperties>
+    </PropertyGroup>
+  </Target>
 </Project>
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.nuspec b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.nuspec
new file mode 100644
index 00000000000..b6c0bf47857
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.nuspec
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
+  <metadata>
+    <id>$id$</id>
+    <version>$version$</version>
+    <authors>$authors$</authors>
+    <requireLicenseAcceptance>true</requireLicenseAcceptance>
+    <licenseUrl>$licenseUrl$</licenseUrl>
+    <projectUrl>$projectUrl$</projectUrl>
+    <iconUrl>$iconUrl$</iconUrl>
+    <description>$description$</description>
+    <copyright>$copyright$</copyright>
+    <tags>$tags$</tags>
+    <repository type="git" url="$repositoryUrl$" commit="$repositoryCommit$" />
+    <dependencies>
+      <group targetFramework=".NETFramework4.6.1">
+        <dependency id="Microsoft.AspNetCore.Hosting" version="$version$" exclude="Build,Analyzers" />
+        <dependency id="Microsoft.AspNetCore.Mvc.RazorPages" version="$version$" exclude="Build,Analyzers" />
+      </group>
+      <group targetFramework=".NETCoreApp2.0">
+        <dependency id="Microsoft.AspNetCore.Hosting" version="$version$" exclude="Build,Analyzers" />
+        <dependency id="Microsoft.AspNetCore.Mvc.RazorPages" version="$version$" exclude="Build,Analyzers" />
+      </group>
+    </dependencies>
+  </metadata>
+
+  <files>
+    <file src="build\**\*" target="build\" />
+    <file src="$OutputBinary$" target="build\netstandard2.0\$AssemblyName$.dll" />
+    <file src="$OutputSymbol$" target="build\netstandard2.0\$AssemblyName$.pdb" />
+    <file src="$TaskBinary$" target="build\netstandard2.0\$AssemblyName$.Tasks.dll" />
+    <file src="$TaskSymbol$" target="build\netstandard2.0\$AssemblyName$.Tasks.pdb" />
+    <file src="$OutputExeX86$" target="build\netstandard2.0\" />
+    <file src="$OutputExeSymbolX86$" target="build\netstandard2.0\" />
+    <file src="$OutputExeX64$" target="build\netstandard2.0\" />
+    <file src="$OutputExeSymbolX64$" target="build\netstandard2.0\" />
+  </files>
+</package>
\ No newline at end of file
-- 
GitLab