Commits

Jason Stangroome committed 2e69a5f

Added Web Pages packaging

Comments (0)

Files changed (3)

     <NugetTool>$(MSBuildProjectDirectory)\nuget\nuget.exe</NugetTool>
   </PropertyGroup>
 
+  <ItemGroup>
+    <Package Include="Microsoft.AspNetMvc3">
+      <DisplayName>ASP.NET MVC 3</DisplayName>
+      <MicrosoftRegistrySubKey>ASP.NET MVC 3\Runtime</MicrosoftRegistrySubKey>
+    </Package>
+    <Package Include="Microsoft.AspNetWebPages">
+      <DisplayName>ASP.NET Web Pages</DisplayName>
+      <MicrosoftRegistrySubKey>ASP.NET Web Pages\v1.0</MicrosoftRegistrySubKey>
+    </Package>
+  </ItemGroup>
+
   <Target Name="Clean">
     <RemoveDir Directories="$(OutDir);$(GatherDir)" />
   </Target>
 
-  <Target Name="Gather">
+  <Target Name="Gather" 
+          Inputs="@(Package)" 
+          Outputs="$(GatherDir)\%(Identity)\**\*.*">
 
     <PropertyGroup>
-      <AssemblyPathRegistryKey>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\ASP.NET MVC 3</AssemblyPathRegistryKey>
-      <AssemblyPath>$([MSBuild]::GetRegistryValueFromView('$(AssemblyPathRegistryKey)', '', '', RegistryView.Registry32))</AssemblyPath>
+      <AssemblyPathRegistryKey>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\%(Package.MicrosoftRegistrySubKey)</AssemblyPathRegistryKey>
+      <AssemblyPath>$([MSBuild]::GetRegistryValueFromView('$(AssemblyPathRegistryKey)', 'InstallPath', '', RegistryView.Registry32))\Assemblies</AssemblyPath>
+
+      <PackageDisplayName>%(Package.DisplayName)</PackageDisplayName>
+      <PackageGatherDir>$(GatherDir)\%(Package.Identity)</PackageGatherDir>
     </PropertyGroup>
 
     <Error Condition="'$(AssemblyPath)'==''"
-           Text="Ensure ASP.NET MVC 3 is installed. Registry key not set: $(AssemblyPathRegistryKey)" />
+           Text="Ensure $(PackageDisplayName) is installed. Registry key not set: $(AssemblyPathRegistryKey)" />
 
     <Error Condition="!Exists($(AssemblyPath))"
-           Text="Ensure ASP.NET MVC 3 is installed. Folder missing: $(AssemblyPath)" />
+           Text="Ensure $(PackageDisplayName) is installed. Folder missing: $(AssemblyPath)" />
 
     <ItemGroup>
       <AssemblyFiles Include="$(AssemblyPath)\**\*.*" />
     </ItemGroup>
 
     <Error Condition="'@(AssemblyFiles)'==''"
-           Text="Ensure ASP.NET MVC 3 is installed. Files missing: $(AssemblyPath)" />
+           Text="Ensure $(PackageDisplayName) is installed. Files missing: $(AssemblyPath)" />
 
-    <MakeDir Directories="$(GatherDir)\lib\net40" />
+    <MakeDir Directories="$(PackageGatherDir)\lib\net40" />
 
     <Copy SourceFiles="@(AssemblyFiles)"
-          DestinationFolder="$(GatherDir)\lib\net40\%(RecursiveDir)"
+          DestinationFolder="$(PackageGatherDir)\lib\net40\%(RecursiveDir)"
           SkipUnchangedFiles="true" />
 
-    <Copy SourceFiles="$(MSBuildProjectDirectory)\src\Microsoft.AspNetMvc3.nuspec"
-          DestinationFolder="$(GatherDir)"
+    <Copy SourceFiles="$(MSBuildProjectDirectory)\src\%(Package.Identity).nuspec"
+          DestinationFolder="$(PackageGatherDir)"
           SkipUnchangedFiles="true" />
 
   </Target>
 
-  <Target Name="Package" DependsOnTargets="Gather">
+  <Target Name="Package"
+          DependsOnTargets="Gather"
+          Inputs="@(Package)" 
+          Outputs="$(OutDir)\%(Identity).*.nupkg">
     <MakeDir Directories="$(OutDir)" />
-    <Exec Command="$(NugetTool) pack $(GatherDir)\Microsoft.AspNetMvc3.nuspec -OutputDirectory $(OutDir) -NoDefaultExcludes" />
+    <Exec Command="$(NugetTool) pack $(GatherDir)\%(Package.Identity)\%(Package.Identity).nuspec -OutputDirectory $(OutDir) -NoDefaultExcludes" />
   </Target>
 
 </Project>

src/Microsoft.AspNetMvc3.nuspec

     <summary>Avoid installing the ASP.NET MVC 3 Tools on the build server.</summary>
     <description>Avoid installing the ASP.NET MVC 3 Tools on the build server.</description>
     <tags>MVC3</tags>
+    <dependencies>
+      <dependency id="Microsoft.AspNetWebPages" version="1.0" />
+    </dependencies>
   </metadata>
 </package>

src/Microsoft.AspNetWebPages.nuspec

+<?xml version="1.0"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+  <metadata>
+    <id>Microsoft.AspNetWebPages</id>
+    <version>1.0</version>
+    <title>ASP.NET Web Pages</title>
+    <authors>Microsoft</authors>
+    <owners>Microsoft</owners>
+    <licenseUrl>http://www.asp.net/web-pages</licenseUrl>
+    <projectUrl>http://www.asp.net/web-pages</projectUrl>
+    <requireLicenseAcceptance>false</requireLicenseAcceptance>
+    <summary>Avoid installing WebMatrix or ASP.NET Web Pages on the build server.</summary>
+    <description>Avoid installing WebMatrix or ASP.NET Web Pages on the build server.</description>
+    <tags>AspNetWebPages</tags>
+  </metadata>
+</package>