Ver Fonte

Remove dependency on Docker from MSBuild targets (#3866)

Changes:
* This removes MSBuild targets which invoke `docker` commands to build
   deb and rpm installers
* Remove installer targets from the KoreBuild context. Put them into
   separate project files
* Simplify the targets used to build installers by reducing duplicate
   variable names and deeply nested MSBuild contexts
* Remove unused dependencies from the Docker build context
Nate McMaster há 7 anos atrás
pai
commit
27deb6f6f8

+ 0 - 7
.azure/pipelines/ci-official.yml

@@ -208,13 +208,6 @@ phases:
       /p:SharedFxRID=linux-musl-x64
       /p:BuildNumber=$(Build.BuildNumber)
     displayName: Build linux-musl-x64 runtime
-  # TODO: configure installers to run in one build.sh invocation
-  - script: >
-      ./build.sh
-      --ci
-      /t:BuildInstallers
-      /p:_SharedFxSourceDir=$(Build.SourcesDirectory)/artifacts/runtime/
-    displayName: Build linux installers
   - task: PublishTestResults@2
     displayName: Publish test results
     condition: always()

+ 14 - 16
Directory.Build.props

@@ -6,15 +6,21 @@
 
     <Authors>Microsoft</Authors>
     <Company>Microsoft Corporation.</Company>
+    <RpmPackageVendor>.NET Foundation</RpmPackageVendor>
     <Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
     <NeutralLanguage>en-US</NeutralLanguage>
     <PackageLicenseUrl>https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt</PackageLicenseUrl>
+    <!-- The SPDX name for the source license. See https://spdx.org/licenses/. -->
+    <PackageLicenseType>Apache-2.0</PackageLicenseType>
     <!--
       Suppress a warning about upcoming deprecation of PackageLicenseUrl. When embedding licenses are supported,
       replace PackageLicenseUrl with PackageLicenseExpression.
     -->
     <NoWarn>$(NoWarn);NU5125</NoWarn>
 
+    <!-- Contact email address for NuGet packages and Linux installers. -->
+    <MaintainerEmail>[email protected]</MaintainerEmail>
+
     <PackageIconUrl>https://go.microsoft.com/fwlink/?LinkID=288859</PackageIconUrl>
     <PackageProjectUrl>https://asp.net</PackageProjectUrl>
     <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
@@ -24,6 +30,12 @@
     <RepositoryUrl>https://github.com/aspnet/AspNetCore</RepositoryUrl>
     <RepositoryType>git</RepositoryType>
 
+    <SharedFxProductName>$(Product) $(PackageVersion) Shared Framework</SharedFxProductName>
+    <SharedFxDescription>Shared Framework for hosting of Microsoft ASP.NET Core applications. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub ($(RepositoryUrl)). We happily accept issues and PRs.</SharedFxDescription>
+  </PropertyGroup>
+
+  <!-- Compilation options -->
+  <PropertyGroup>
     <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)eng\AspNetCore.snk</AssemblyOriginatorKeyFile>
     <SignAssembly>true</SignAssembly>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -40,6 +52,7 @@
   <Import Project="build\external-dependencies.props" />
   <Import Project="build\sources.props" />
 
+  <!-- Folder layout -->
   <PropertyGroup>
     <ArtifactsDir Condition="'$(ArtifactsDir)' == ''">$(RepositoryRoot)artifacts\</ArtifactsDir>
     <ArtifactsObjDir>$(ArtifactsDir)obj\</ArtifactsObjDir>
@@ -48,24 +61,9 @@
     <ArtifactsBinDir>$(ArtifactsConfigurationDir)bin\</ArtifactsBinDir>
     <InstallersOutputPath>$(ArtifactsConfigurationDir)installers\</InstallersOutputPath>
     <PackageOutputPath>$(ArtifactsDir)build\</PackageOutputPath>
-
-    <!-- Defines the default RID of the platform currently running the build. -->
-    <HostRid Condition=" '$(HostRid)' == '' AND $([MSBuild]::IsOSPlatform('Windows'))">win-x64</HostRid>
-    <HostRid Condition=" '$(HostRid)' == '' AND $([MSBuild]::IsOSPlatform('OSX'))">osx-x64</HostRid>
-    <HostRid Condition=" '$(HostRid)' == '' AND $([MSBuild]::IsOSPlatform('Linux'))">linux-x64</HostRid>
-
-    <!-- This defines the list of RIDs supported by the ASP.NET Core shared framework. -->
-    <SupportedRuntimeIdentifiers>
-      win-x64;
-      win-x86;
-      win-arm;
-      osx-x64;
-      linux-musl-x64;
-      linux-x64;
-      linux-arm
-    </SupportedRuntimeIdentifiers>
   </PropertyGroup>
 
+  <Import Project="eng\targets\RuntimeIdentifiers.props" />
   <Import Project="eng\targets\Cpp.Common.props"  Condition="'$(MSBuildProjectExtension)' == '.vcxproj'" />
   <Import Project="eng\targets\SharedFx.Common.props"  Condition="'$(MSBuildProjectExtension)' == '.shfxproj'" />
   <Import Project="eng\targets\Wix.Common.props"  Condition="'$(MSBuildProjectExtension)' == '.wixproj'" />

+ 2 - 1
build/Publish.targets

@@ -48,7 +48,8 @@
       Overwrite="true" />
 
     <ItemGroup>
-      <SharedFxVersionBadge Include="$(IntermediateDir)$(SharedFxInstallerName)-%(AllSharedFxRIDs.Identity)-version-badge.svg" />
+      <_AllSharedFxRIDs Include="$(SupportedRuntimeIdentifiers)" />
+      <SharedFxVersionBadge Include="$(IntermediateDir)aspnetcore-runtime-%(AllSharedFxRIDs.Identity)-version-badge.svg" />
     </ItemGroup>
 
     <GenerateSvgBadge

+ 0 - 75
build/SharedFx.props

@@ -1,75 +0,0 @@
-<Project>
-  <PropertyGroup>
-    <SharedFxRid Condition=" '$(SharedFxRid)' == '' AND $([MSBuild]::IsOSPlatform('Windows'))">win-x64</SharedFxRid>
-    <SharedFxRid Condition=" '$(SharedFxRid)' == '' AND $([MSBuild]::IsOSPlatform('OSX'))">osx-x64</SharedFxRid>
-    <SharedFxRid Condition=" '$(SharedFxRid)' == '' AND $([MSBuild]::IsOSPlatform('Linux'))">linux-x64</SharedFxRid>
-
-    <!-- directories -->
-    <_WorkRoot>$(RepositoryRoot).w\$(SharedFxRID)\</_WorkRoot>
-    <_WorkLayoutDir>$(_WorkRoot).l\</_WorkLayoutDir>
-    <_WorkOutputDir>$(_WorkRoot).o\</_WorkOutputDir>
-    <_MetapackageSrcRoot>$(RepositoryRoot)src\Packages\</_MetapackageSrcRoot>
-    <_TemplatesDir>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDir>
-    <_DockerDir>$(MSBuildThisFileDirectory)tools\docker\</_DockerDir>
-    <_PackagingDir>$(MSBuildThisFileDirectory)tools\packaging\</_PackagingDir>
-    <_SharedFxSourceDir>$(RepositoryRoot).deps\Signed\SharedFx\</_SharedFxSourceDir>
-    <_InstallerSourceDir>$(RepositoryRoot).deps\Installers\</_InstallerSourceDir>
-    <_SymbolsSourceDir>$(RepositoryRoot).deps\symbols\</_SymbolsSourceDir>
-    <_DockerRootDir>/opt/code/</_DockerRootDir>
-    <_InstallersOutputDir>$(ArtifactsDir)installers\</_InstallersOutputDir>
-
-    <ArchiveExtension>.tar.gz</ArchiveExtension>
-    <ArchiveExtension Condition="$(SharedFxRID.StartsWith('win'))">.zip</ArchiveExtension>
-
-    <SharedFrameworkTargetFramework>netcoreapp2.2</SharedFrameworkTargetFramework>
-
-    <!-- installers -->
-    <SharedFxInstallerName>aspnetcore-runtime</SharedFxInstallerName>
-    <!--
-      This is named aspnetcore-runtime-internal because it only includes Microsoft.AspNetCore.All and is an intermediate file passed off to signing, installer generation, etc.
-      Subsequent build steps will combine this with Microsoft.NETCore.App and produce final tarballs/zips.
-    -->
-    <SharedFxIntermediateArchiveBaseName>$(SharedFxInstallerName)-internal</SharedFxIntermediateArchiveBaseName>
-    <DebConfigInFile>$(_PackagingDir)debian_config.json.in</DebConfigInFile>
-    <PublicCoreFeedPrefix>https://dotnetcli.blob.core.windows.net/dotnet/</PublicCoreFeedPrefix>
-
-    <!-- In an orchestrated build, this may be overriden to other Azure feeds. -->
-    <DotNetAssetRootUrl Condition="'$(DotNetAssetRootUrl)'==''">$(PublicCoreFeedPrefix)</DotNetAssetRootUrl>
-
-    <DotnetRuntimeFileNamePrefix>dotnet-runtime-$(MicrosoftNETCoreAppPackageVersion)</DotnetRuntimeFileNamePrefix>
-    <RuntimeArchiveLinkPrefix>$(DotNetAssetRootUrl)Runtime/$(MicrosoftNETCoreAppPackageVersion)/$(DotnetRuntimeFileNamePrefix)</RuntimeArchiveLinkPrefix>
-
-    <SharedFxIntermediateArchiveFilePrefix>$(_SharedFxSourceDir)$(SharedFxIntermediateArchiveBaseName)-$(PackageVersion)</SharedFxIntermediateArchiveFilePrefix>
-
-    <!-- installer versions -->
-    <!-- CLI would take a dependency such as 'aspnetcore-runtime-M.N >= M.N.P'. Here M.N is the InstallerIdVersion and M.N.P is the InstallerPackageVersion -->
-    <InstallerIdVersion>$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</InstallerIdVersion>
-    <InstallerPackageVersion>$(InstallerIdVersion).$(AspNetCorePatchVersion)</InstallerPackageVersion>
-    <!-- Deb installers are versioned as M.N.P~Build following the core-setup convention -->
-    <DebInstallerPackageVersion>$(InstallerPackageVersion)</DebInstallerPackageVersion>
-    <DebInstallerPackageVersion Condition="'$(PackageVersionSuffix)' != ''">$(DebInstallerPackageVersion)~$(PackageVersionSuffix)</DebInstallerPackageVersion>
-    <PackageRevision>1</PackageRevision>
-    <!-- While the revision number of Debian installers must stay at 1, the RPM installers will include the build number in the revision if available -->
-    <RpmPackageRevision>$(PackageRevision)</RpmPackageRevision>
-    <RpmPackageRevision Condition="'$(PackageVersionSuffix)' != ''">0.1.$(PackageVersionSuffix)</RpmPackageRevision>
-    <RpmPackageRevision>$([System.String]::Copy('$(RpmPackageRevision)').Replace('-', '_'))</RpmPackageRevision>
-
-    <!-- installer metadata -->
-    <MaintainerName>Microsoft</MaintainerName>
-    <MaintainerEmail>[email protected]</MaintainerEmail>
-    <Homepage>https://www.asp.net/</Homepage>
-    <InstallRoot>/usr/share/dotnet</InstallRoot>
-    <LicenseType>Apache-2.0</LicenseType>
-    <SharedFxSummary>Microsoft ASP.NET Core $(PackageVersion) Shared Framework</SharedFxSummary>
-    <SharedFxDescription>Shared Framework for hosting of Microsoft ASP.NET Core applications. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/aspnet/home). We happily accept issues and PRs.</SharedFxDescription>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <WindowsSharedFxRIDs Include="win-x64;win-x86;win-arm"/>
-    <NonWindowsSharedFxRIDs Include="osx-x64" CrossgenSymbols="false" />
-    <NonWindowsSharedFxRIDs Include="linux-musl-x64" />
-    <NonWindowsSharedFxRIDs Include="linux-x64" />
-    <NonWindowsSharedFxRIDs Include="linux-arm" CrossGen="false" />
-    <AllSharedFxRIDs Include="@(WindowsSharedFxRIDs);@(NonWindowsSharedFxRIDs)"/>
-  </ItemGroup>
-</Project>

+ 4 - 5
build/SharedFx.targets

@@ -1,6 +1,4 @@
 <Project>
-  <Import Project="SharedFx.props" />
-
   <PropertyGroup>
     <UnitTestFxProject>$(RepositoryRoot)src\Framework\Framework.UnitTests\Framework.UnitTests.csproj</UnitTestFxProject>
     <UnitTestFxProject>$([MSBuild]::NormalizePath($(UnitTestFxProject)))</UnitTestFxProject>
@@ -14,8 +12,9 @@
     <ProjectToBuild Include="$(RepositoryRoot)src\Framework\**\*.pkgproj" />
     <ProjectToBuild Include="$(RepositoryRoot)src\Framework\**\*.shfxproj" />
     <ProjectToBuild Include="$(UnitTestFxProject)" />
-    <ProjectToBuild Include="$(RepositoryRoot)src\Installers\Archive.Internal\*.*proj" />
-    <ProjectToBuild Include="$(RepositoryRoot)src\Installers\Archive.Redist\*.*proj" />
+    <ProjectToBuild Condition=" '$(BuildRuntimeArchive)' != 'false' " Include="$(RepositoryRoot)src\Installers\Archive\*.*proj" />
+    <ProjectToBuild Condition=" '$(SharedFxRid)' == 'linux-x64' AND '$(LinuxInstallerType)' == 'deb' " Include="$(RepositoryRoot)src\Installers\Debian\*.*proj" />
+    <ProjectToBuild Condition=" '$(SharedFxRid)' == 'linux-x64' AND '$(LinuxInstallerType)' == 'rpm' " Include="$(RepositoryRoot)src\Installers\Rpm\*.*proj" />
   </ItemGroup>
 
   <Target Name="BuildSharedFx" DependsOnTargets="$(BuildSharedFxDependsOn)" />
@@ -69,8 +68,8 @@
   </Target>
 
   <Target Name="TestSharedFx" DependsOnTargets="GeneratePropsFiles;InstallDotNet">
-    <PropertyGroup>
 
+    <PropertyGroup>
       <!-- The file path to the log file, from within the container -->
       <UnitTestFxTrxLogFile>$(LogOutputDir)SharedFx-UnitTests-$(Version).trx</UnitTestFxTrxLogFile>
       <!-- The trx file path from the perspective of the TeamCity agent -->

+ 0 - 189
build/SharedFxInstaller.targets

@@ -1,189 +0,0 @@
-<Project>
-  <Target Name="BuildInstallers" DependsOnTargets="GenerateRpms;GenerateDebs" />
-
-  <Target Name="_EnsureInstallerPrerequisites">
-    <MakeDir Directories="$(_InstallersOutputDir)" />
-
-    <!-- Check Docker server OS -->
-    <Exec Command="docker version -f &quot;{{.Server.Os}}&quot;" StandardOutputImportance="Normal" ConsoleToMSBuild="true">
-      <Output TaskParameter="ConsoleOutput" PropertyName="DockerHostOS" />
-    </Exec>
-
-    <Error
-      Text="Docker host must be using Linux containers."
-      Condition="'$(DockerHostOS)' != 'linux'"/>
-    <Error
-      Text="Expected archive missing at $(SharedFxIntermediateArchiveFilePrefix)-linux-x64.tar.gz."
-      Condition="!Exists('$(SharedFxIntermediateArchiveFilePrefix)-linux-x64.tar.gz')" />
-  </Target>
-
-  <Target Name="_BuildDockerImage">
-    <Exec Command="docker build --build-arg USER_ID=%24(id -u) -t docker-image-$(Image) $(Image)" WorkingDirectory="$(_DockerDir)" />
-  </Target>
-
-  <Target Name="_RemoveDockerImage">
-    <Exec Command="docker rmi docker-image-$(Image)" />
-  </Target>
-
-  <Target Name="_GenerateRpm">
-    <!-- Clear working directory -->
-    <RemoveDir Directories="$(_WorkRoot)" />
-    <MakeDir Directories="$(_WorkRoot)" />
-
-    <!-- Create layout: Extract archive if given -->
-    <MakeDir Directories="$(_WorkRoot)package_root\" />
-    <Exec Command="tar -xzf $(SharedFxArchive) -C $(_WorkRoot)package_root\" Condition="'$(SharedFxArchive)'!=''" />
-
-    <!-- Create layout: Create changelog -->
-    <PropertyGroup>
-      <ChangeLogProps>DATE=$([System.DateTime]::UtcNow.ToString(ddd MMM dd yyyy))</ChangeLogProps>
-      <ChangeLogProps>$(ChangeLogProps);MAINTAINER_NAME=$(RpmMaintainerName)</ChangeLogProps>
-      <ChangeLogProps>$(ChangeLogProps);MAINTAINER_EMAIL=$(RpmMaintainerEmail)</ChangeLogProps>
-      <ChangeLogProps>$(ChangeLogProps);PACKAGE_VERSION=$(RpmPackageVersion)</ChangeLogProps>
-      <ChangeLogProps>$(ChangeLogProps);PACKAGE_REVISION=$(RpmRevision)</ChangeLogProps>
-    </PropertyGroup>
-
-    <GenerateFileFromTemplate TemplateFile="$(_PackagingDir)changelog.in" OutputPath="$(_WorkRoot)templates/changelog" Properties="$(ChangeLogProps)" />
-
-    <!-- Run fpm -->
-    <!-- Retry added due to fpm/docker race where .w/package_root directory cannot be resolved -->
-    <Run
-      FileName="docker"
-      Command="run --rm -v $(RepositoryRoot):$(_DockerRootDir) docker-image-$(Image) fpm --verbose -s dir -t rpm -n $(RpmName)-$(RpmIdVersion) -p $(_DockerRootDir)artifacts/installers/$(RpmName)-$(RpmFileVersion)-$(RpmFileSuffix) -v $(RpmPackageVersion) --iteration $(RpmRevision) -a amd64 $(RpmArguments) --rpm-changelog $(_DockerRootDir).w/$(SharedFxRid)/templates/changelog --rpm-summary &quot;$(RpmMSummary)&quot; --description &quot;$(RpmDescription)&quot; --maintainer &quot;$(RpmMaintainerName) &lt;$(RpmMaintainerEmail)&gt;&quot; --vendor &quot;$(RpmVendor)&quot; --license &quot;$(RpmLicense)&quot; --url &quot;$(RpmHomepage)&quot; $(_DockerRootDir).w/$(SharedFxRid)/package_root/=&quot;$(RpmInstallRoot)/&quot;"
-      MaxRetries="5"/>
-  </Target>
-
-  <Target Name="GenerateRpms" DependsOnTargets="_EnsureInstallerPrerequisites">
-     <PropertyGroup>
-      <Image>rhel.7</Image>
-      <RpmVendor>.NET Foundation</RpmVendor>
-      <RHInstallRoot>/opt/rh/rh-dotnet20/root/usr/lib64/dotnet</RHInstallRoot>
-      <Rpm_DotnetRuntimeDependencyId>dotnet-runtime-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</Rpm_DotnetRuntimeDependencyId>
-      <Rpm_DotnetRuntimeDependencyVersion>$(MicrosoftNETCoreAppPackageVersion.Split('-')[0])</Rpm_DotnetRuntimeDependencyVersion>
-    </PropertyGroup>
-
-    <!-- Build Docker Image -->
-    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildDockerImage" Properties="Image=$(Image)" />
-
-    <ItemGroup>
-      <RpmSharedFxDependencies Include="$(Rpm_DotnetRuntimeDependencyId)" Version="$(Rpm_DotnetRuntimeDependencyVersion)" />
-      <RpmRHSharedFxDirectories Include="$(RHInstallRoot)/shared" />
-      <RpmGenericSharedFxDirectories Include="$(InstallRoot)/shared" />
-    </ItemGroup>
-
-    <PropertyGroup>
-      <RpmSharedFxArguments>@(RpmSharedFxDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</RpmSharedFxArguments>
-      <RpmRHSharedFxArguments>$(RpmSharedFxArguments) @(RpmRHSharedFxDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</RpmRHSharedFxArguments>
-      <RpmGenericSharedFxArguments>$(RpmSharedFxArguments) @(RpmGenericSharedFxDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</RpmGenericSharedFxArguments>
-
-      <RpmCommonProps>Image=$(Image);RpmVendor=$(RpmVendor);RpmName=$(SharedFxInstallerName)</RpmCommonProps>
-      <RpmCommonProps>$(RpmCommonProps);RpmMaintainerName=$(MaintainerName);RpmMaintainerEmail=$(MaintainerEmail)</RpmCommonProps>
-      <RpmCommonProps>$(RpmCommonProps);RpmHomepage=$(Homepage);RpmRevision=$(RpmPackageRevision)</RpmCommonProps>
-      <RpmCommonProps>$(RpmCommonProps);RpmLicense=$(LicenseType)</RpmCommonProps>
-      <RpmCommonProps>$(RpmCommonProps);SharedFxArchive=$(SharedFxIntermediateArchiveFilePrefix)-linux-x64.tar.gz</RpmCommonProps>
-      <RpmCommonProps>$(RpmCommonProps);RpmMSummary=$(SharedFxSummary);RpmDescription=$(SharedFxDescription)</RpmCommonProps>
-      <RpmGenericProps>RpmInstallRoot=$(InstallRoot)</RpmGenericProps>
-      <RpmRHProps>RpmInstallRoot=$(RHInstallRoot)</RpmRHProps>
-      <RpmProps>RpmIdVersion=$(InstallerIdVersion);RpmPackageVersion=$(InstallerPackageVersion);RpmFileVersion=$(PackageVersion)</RpmProps>
-
-      <RpmSharedFxProps>$(RpmCommonProps);$(RpmGenericProps);$(RpmProps);RpmArguments=$(RpmGenericSharedFxArguments);RpmFileSuffix=x64.rpm</RpmSharedFxProps>
-      <RpmRHSharedFxProps>$(RpmCommonProps);$(RpmRHProps);$(RpmProps);RpmArguments=$(RpmRHSharedFxArguments);RpmFileSuffix=rh.rhel.7-x64.rpm</RpmRHSharedFxProps>
-    </PropertyGroup>
-
-    <!-- Generic installer-->
-    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RpmSharedFxProps)" />
-
-    <!-- RH installer-->
-    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RpmRHSharedFxProps)" />
-
-    <!-- Remove Docker Image to save disk space -->
-    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveDockerImage" Properties="Image=$(Image)" />
-  </Target>
-
-  <Target Name="RunDebTool">
-    <PropertyGroup>
-      <BuildDebInstallerScript>$(RepositoryRoot)src/Installers/Debian/build.sh</BuildDebInstallerScript>
-    </PropertyGroup>
-
-    <!-- Build deb package -->
-    <Exec Command="$(BuildDebInstallerScript) -i $(_WorkLayoutDir) -o $(_WorkOutputDir) -n $(INSTALLER_NAME) -v $(INSTALLER_VERSION)" />
-  </Target>
-
-  <Target Name="_GenerateDeb">
-    <!-- Create layout: Clear work directory -->
-    <RemoveDir Directories="$(_WorkRoot)" />
-    <MakeDir Directories="$(_WorkRoot)" />
-
-    <!-- Create layout: Extract archive if given -->
-    <MakeDir Directories="$(_WorkLayoutDir)package_root\" />
-    <Exec Command="tar -xzf $(SharedFxArchive) -C $(_WorkLayoutDir)package_root/" Condition="'$(SharedFxArchive)'!=''" />
-
-    <!-- Create layout: Generate and Place debian_config.json -->
-    <PropertyGroup>
-      <DebConfigProps>MAINTAINER_NAME=$(MaintainerName)</DebConfigProps>
-      <DebConfigProps>$(DebConfigProps);MAINTAINER_EMAIL=$(MaintainerEmail)</DebConfigProps>
-      <DebConfigProps>$(DebConfigProps);HOMEPAGE=$(Homepage)</DebConfigProps>
-      <DebConfigProps>$(DebConfigProps);INSTALL_ROOT=$(InstallRoot)</DebConfigProps>
-      <DebConfigProps>$(DebConfigProps);PACKAGE_NAME=$(DebPrefix)</DebConfigProps>
-      <DebConfigProps>$(DebConfigProps);PACKAGE_REVISION=$(PackageRevision)</DebConfigProps>
-      <DebConfigProps>$(DebConfigProps);LICENSE_TYPE=$(LicenseType)</DebConfigProps>
-      <DebConfigProps>$(DebConfigProps);SHORT_DESCRIPTION=$(DebSummary)</DebConfigProps>
-      <DebConfigProps>$(DebConfigProps);LONG_DESCRIPTION=$(DebDescription)</DebConfigProps>
-      <DebConfigProps>$(DebConfigProps);DEBIAN_DEPENDENCIES=$(DebDependencies)</DebConfigProps>
-    </PropertyGroup>
-
-    <GenerateFileFromTemplate TemplateFile="$(DebConfigInFile)" OutputPath="$(_WorkLayoutDir)debian_config.json" Properties="$(DebConfigProps)" />
-
-    <!-- Build SharedFx Bundle Deb package -->
-
-    <Exec Command="docker run --rm -v $(RepositoryRoot):$(_DockerRootDir) -e DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true -e INSTALLER_NAME=$(DebPrefix)-$(DebIdVersion) -e INSTALLER_VERSION=$(DebPackageVersion) docker-image-$(Image) ./build.sh /t:RunDebTool"
-      ContinueOnError="WarnAndContinue" />
-
-    <!-- Copy SharedFx packages to output -->
-    <ItemGroup>
-      <GeneratedDebFiles Include="$(_WorkOutputDir)/*.deb" />
-    </ItemGroup>
-
-    <Error Text="@(GeneratedDebFiles->Count()) deb installer files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
-
-    <Copy
-      DestinationFiles="$(_InstallersOutputDir)$(DebPrefix)-$(DebFileVersion)-x64.deb"
-      SourceFiles="@(GeneratedDebFiles)"
-      OverwriteReadOnlyFiles="True"
-      SkipUnchangedFiles="False"
-      UseHardlinksIfPossible="False" />
-  </Target>
-
-  <Target Name="GenerateDebs" DependsOnTargets="_EnsureInstallerPrerequisites">
-    <PropertyGroup>
-      <Deb_DotnetRuntimeDependencyId>dotnet-runtime-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</Deb_DotnetRuntimeDependencyId>
-      <Deb_DotnetRuntimeDependencyVersion>$(MicrosoftNETCoreAppPackageVersion)</Deb_DotnetRuntimeDependencyVersion>
-      <!-- Needed some creativity to convert the PackageVersion M.N.P-Build to the installer version M.N.P~Build, The conditional handles stabilized builds -->
-      <Deb_DotnetRuntimeDependencyVersion Condition="$(Deb_DotnetRuntimeDependencyVersion.Contains('-'))">$(Deb_DotnetRuntimeDependencyVersion.Substring(0, $(Deb_DotnetRuntimeDependencyVersion.IndexOf('-'))))~$(Deb_DotnetRuntimeDependencyVersion.Substring($([MSBuild]::Add($(Deb_DotnetRuntimeDependencyVersion.IndexOf('-')), 1))))</Deb_DotnetRuntimeDependencyVersion>
-    </PropertyGroup>
-
-    <ItemGroup>
-      <_DebSharedFxDependencies Include="$(Deb_DotnetRuntimeDependencyId)" Version="$(Deb_DotnetRuntimeDependencyVersion)"/>
-    </ItemGroup>
-
-    <PropertyGroup>
-      <Image>ubuntu.14.04</Image>
-
-      <DebSharedFxDependencies>@(_DebSharedFxDependencies->'"%(Identity)": { "package_version": "%(Version)" }', ', ')</DebSharedFxDependencies>
-
-      <DebCommonProps>Image=$(Image);DebPrefix=$(SharedFxInstallerName)</DebCommonProps>
-      <DebCommonProps>$(DebCommonProps);DebSummary=$(SharedFxSummary);DebDescription=$(SharedFxDescription)</DebCommonProps>
-      <DebCommonProps>$(DebCommonProps);SharedFxArchive=$(SharedFxIntermediateArchiveFilePrefix)-linux-x64.tar.gz</DebCommonProps>
-
-      <DebProps>DebIdVersion=$(InstallerIdVersion);DebPackageVersion=$(DebInstallerPackageVersion);DebFileVersion=$(PackageVersion);DebDependencies=$(DebSharedFxDependencies)</DebProps>
-    </PropertyGroup>
-
-    <!-- Build Docker Image -->
-    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildDockerImage" Properties="Image=$(Image)" />
-
-    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDeb" Properties="$(DebCommonProps);$(DebProps)" />
-
-    <!-- Remove Docker Image to save disk space -->
-    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveDockerImage" Properties="Image=$(Image)" />
-  </Target>
-</Project>

+ 34 - 0
build/docker/bionic.Dockerfile

@@ -0,0 +1,34 @@
+FROM microsoft/dotnet:2.1-runtime-deps-bionic
+
+ARG USER
+ARG USER_ID
+ARG GROUP_ID
+
+WORKDIR /code/build
+RUN mkdir -p "/home/$USER" && chown "${USER_ID}:${GROUP_ID}" "/home/$USER"
+ENV HOME "/home/$USER"
+
+RUN apt-get update && \
+    apt-get -qqy install --no-install-recommends \
+        jq \
+        wget \
+        locales \
+        python \
+        fakeroot \
+        debhelper \
+        build-essential \
+        devscripts \
+        unzip && \
+    rm -rf /var/lib/apt/lists/*
+
+# Resolves warnings about locale in the perl scripts for building debian installers
+RUN locale-gen en_US.UTF-8
+ENV LANGUAGE=en_US.UTF-8 \
+    LANG=en_US.UTF-8 \
+    LC_ALL=en_US.UTF-8
+
+# Set the user to non-root
+USER $USER_ID:$GROUP_ID
+
+# Skip package initilization
+ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

+ 11 - 11
build/tools/docker/rhel.7/Dockerfile → build/docker/rhel.Dockerfile

@@ -1,15 +1,15 @@
-#
-# Copyright (c) .NET Foundation. All rights reserved.
-# Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-#
-
 # Dockerfile that creates a container suitable to build dotnet-cli
 FROM microsoft/dotnet-buildtools-prereqs:rhel-7-rpmpkg-e1b4a89-20175311035359
 
 # Setup User to match Host User, and give superuser permissions
-ARG USER_ID=0
-RUN useradd -m code_executor -u ${USER_ID} -g root
-RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+ARG USER
+ARG USER_ID
+ARG GROUP_ID
+
+WORKDIR /code/build
+
+RUN useradd -m ${USER} --uid ${USER_ID} -g root -G ${GROUP_ID}
+RUN echo '${USER} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
 
 # With the User Change, we need to change permssions on these directories
 RUN chmod -R a+rwx /usr/local
@@ -17,7 +17,7 @@ RUN chmod -R a+rwx /home
 RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
 
 # Set user to the one we just created
-USER ${USER_ID}
+USER $USER_ID:$GROUP_ID
 
-# Set working directory
-WORKDIR /opt/code
+# Skip package initilization
+ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

+ 2 - 0
build/repo.props

@@ -1,4 +1,6 @@
 <Project>
+  <Import Project="..\eng\targets\RuntimeIdentifiers.props" />
+
   <PropertyGroup>
     <!-- This repo does not have solutions to build -->
     <DisableDefaultTargets>true</DisableDefaultTargets>

+ 4 - 2
build/repo.targets

@@ -3,12 +3,14 @@
   <Import Project="PackageArchive.targets" />
   <Import Project="AzureIntegration.targets" />
   <Import Project="SharedFx.targets" />
-  <Import Project="SharedFxInstaller.targets" />
   <Import Project="CodeSign.targets" />
   <Import Project="Publish.targets" />
   <Import Project="buildorder.props" />
 
   <PropertyGroup>
+    <!-- Some projects need access to tasks bundled in KoreBuild. -->
+    <BuildProperties>$(BuildProperties);BuildToolsTaskAssembly=$(_BuildToolsAssembly)</BuildProperties>
+
     <GeneratedPackageVersionPropsPath>$(IntermediateDir)dependencies.g.props</GeneratedPackageVersionPropsPath>
     <GeneratedRestoreSourcesPropsPath>$(IntermediateDir)sources.g.props</GeneratedRestoreSourcesPropsPath>
     <GeneratedBrandingPropsPath>$(IntermediateDir)branding.g.props</GeneratedBrandingPropsPath>
@@ -29,7 +31,7 @@
   <Target Name="ResolveRepoInfo" DependsOnTargets="_PrepareRepositories;GetLineupPackageInfo">
     <!-- We need to pass the NETCoreApp package versions to msbuild so that it doesn't complain about us using a different one than it was restored against.  -->
     <PropertyGroup>
-      <DesignTimeBuildProps>MicrosoftNETCoreAppPackageVersion=$(MicrosoftNETCoreAppPackageVersion);</DesignTimeBuildProps>
+      <DesignTimeBuildProps>$(BuildProperties);MicrosoftNETCoreAppPackageVersion=$(MicrosoftNETCoreAppPackageVersion);</DesignTimeBuildProps>
       <DesignTimeBuildProps>$(DesignTimeBuildProps);MicrosoftNETCoreApp22PackageVersion=$(MicrosoftNETCoreApp22PackageVersion);</DesignTimeBuildProps>
       <DesignTimeBuildProps>$(DesignTimeBuildProps);MicrosoftNETCoreApp21PackageVersion=$(MicrosoftNETCoreApp21PackageVersion);</DesignTimeBuildProps>
       <DesignTimeBuildProps>$(DesignTimeBuildProps);MicrosoftNETCoreApp20PackageVersion=$(MicrosoftNETCoreApp20PackageVersion);</DesignTimeBuildProps>

+ 0 - 52
build/tools/docker/ubuntu.14.04/Dockerfile

@@ -1,52 +0,0 @@
-#
-# Copyright (c) .NET Foundation. All rights reserved.
-# Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-#
-
-# Dockerfile that creates a container suitable to build dotnet-cli
-FROM ubuntu:14.04
-
-# Misc Dependencies for build
-RUN apt-get update && \
-    apt-get -qqy install \
-        curl \
-        unzip \
-        gettext \
-        sudo \
-        libunwind8 \
-        libkrb5-3 \
-        libicu52 \
-        liblttng-ust0 \
-        libssl1.0.0 \
-        zlib1g \
-        libuuid1 \
-        debhelper \
-        build-essential \
-        devscripts \
-        git \
-        cmake \
-        clang-3.5 \
-        lldb-3.6 \
-        wget && \
-    apt-get clean && \
-    rm -rf /var/lib/apt/lists/*
-
-# Use clang as c++ compiler
-RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.5 100
-RUN update-alternatives --set c++ /usr/bin/clang++-3.5
-
-# Setup User to match Host User, and give superuser permissions
-ARG USER_ID=0
-RUN useradd -m code_executor -u ${USER_ID} -g sudo
-RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
-
-# With the User Change, we need to change permissions on these directories
-RUN chmod -R a+rwx /usr/local
-RUN chmod -R a+rwx /home
-RUN chmod -R 755 /usr/lib/sudo
-
-# Set user to the one we just created
-USER ${USER_ID}
-
-# Set working directory
-WORKDIR /opt/code

+ 0 - 34
build/tools/packaging/debian_config.json.in

@@ -1,34 +0,0 @@
-{
-    "maintainer_name": "${MAINTAINER_NAME}",
-    "maintainer_email": "${MAINTAINER_EMAIL}",
-
-    "package_name": "${PACKAGE_NAME}",
-    "install_root": "${INSTALL_ROOT}",
-
-    "short_description": "${SHORT_DESCRIPTION}",
-    "long_description": "${LONG_DESCRIPTION}",
-    "homepage": "${HOMEPAGE}",
-
-    "release":{
-        "package_version":"0.0.0.0",
-        "package_revision":"${PACKAGE_REVISION}",
-        "urgency" : "low",
-        "changelog_message" : ""
-    },
-
-    "control": {
-        "priority":"standard",
-        "section":"devel",
-        "architecture":"any"
-    },
-
-    "copyright": "Microsoft",
-    "license": {
-        "type": "${LICENSE_TYPE}",
-        "full_text": "Copyright (c) .NET Foundation. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthese files except in compliance with the License. You may obtain a copy of the\nLicense at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed\nunder the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\nCONDITIONS OF ANY KIND, either express or implied. See the License for the\nspecific language governing permissions and limitations under the License."
-    },
-
-    "debian_dependencies": {
-        ${DEBIAN_DEPENDENCIES}
-    }
-}

+ 6 - 0
dockerbuild.sh

@@ -87,6 +87,12 @@ if ! __machine_has docker; then
     exit 1
 fi
 
+commit_hash="$(git rev-parse HEAD || true)"
+
+if [ ! -z "$commit_hash" ]; then
+    build_args[${#build_args[*]}]="-p:RepositoryCommit=$commit_hash"
+fi
+
 dockerfile="$DIR/build/docker/$image.Dockerfile"
 tagname="aspnetcore-build-$image"
 

+ 25 - 0
eng/targets/RuntimeIdentifiers.props

@@ -0,0 +1,25 @@
+<Project>
+  <!-- Runtime identifiers -->
+  <PropertyGroup>
+    <!-- Defines the runtime identifier of the shared framework -->
+    <SharedFxRid Condition=" '$(SharedFxRid)' == '' AND $([MSBuild]::IsOSPlatform('Windows'))">win-x64</SharedFxRid>
+    <SharedFxRid Condition=" '$(SharedFxRid)' == '' AND $([MSBuild]::IsOSPlatform('OSX'))">osx-x64</SharedFxRid>
+    <SharedFxRid Condition=" '$(SharedFxRid)' == '' AND $([MSBuild]::IsOSPlatform('Linux'))">linux-x64</SharedFxRid>
+
+    <!-- Defines the default RID of the platform currently running the build. -->
+    <HostRid Condition=" '$(HostRid)' == '' AND $([MSBuild]::IsOSPlatform('Windows'))">win-x64</HostRid>
+    <HostRid Condition=" '$(HostRid)' == '' AND $([MSBuild]::IsOSPlatform('OSX'))">osx-x64</HostRid>
+    <HostRid Condition=" '$(HostRid)' == '' AND $([MSBuild]::IsOSPlatform('Linux'))">linux-x64</HostRid>
+
+    <!-- This defines the list of RIDs supported by the ASP.NET Core shared framework. -->
+    <SupportedRuntimeIdentifiers>
+      win-x64;
+      win-x86;
+      win-arm;
+      osx-x64;
+      linux-musl-x64;
+      linux-x64;
+      linux-arm
+    </SupportedRuntimeIdentifiers>
+  </PropertyGroup>
+</Project>

+ 1 - 1
src/Installers/Archive.Internal/Archive.Internal.zipproj → src/Installers/Archive/Archive.Internal.zipproj

@@ -16,7 +16,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <ProjectReference Include="..\..\Framework\*\src\*.shfxproj">
+    <ProjectReference Include="..\..\Framework\**\*.shfxproj">
       <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
       <OutputItemType>_ResolvedFxProjects</OutputItemType>
     </ProjectReference>

+ 0 - 0
src/Installers/Archive.Redist/Archive.Redist.zipproj → src/Installers/Archive/Archive.Redist.zipproj


+ 110 - 0
src/Installers/Debian/Runtime.debproj

@@ -0,0 +1,110 @@
+<!--
+  This project produces a debian installer for Linux x64 platforms only.
+-->
+<Project DefaultTargets="Build">
+
+  <UsingTask Condition=" '$(BuildToolsTaskAssembly)' != '' AND Exists('$(BuildToolsTaskAssembly)') " TaskName="Microsoft.AspNetCore.BuildTools.GenerateFileFromTemplate" AssemblyFile="$(BuildToolsTaskAssembly)" />
+
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
+
+  <!-- Output paths -->
+  <PropertyGroup>
+    <BaseIntermediateOutputPath>$(RepositoryRoot)obj\Debian\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
+    <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(SharedFxRid)\</IntermediateOutputPath>
+    <!-- Must be named "package_root/". This is expected by the build.sh script in this project. -->
+    <IntermediatePackageRoot>$(IntermediateOutputPath)package_root\</IntermediatePackageRoot>
+    <OutputFileName>$(RuntimeInstallerBaseName)-$(SharedFxVersion)-$(SharedFxRid).deb</OutputFileName>
+    <OutputPath>$(InstallersOutputPath)</OutputPath>
+    <TargetPath>$(InstallersOutputPath)$(OutputFileName)</TargetPath>
+  </PropertyGroup>
+
+  <!-- Installer settings -->
+  <PropertyGroup>
+    <DebianPackageInstallRoot>/usr/share/dotnet</DebianPackageInstallRoot>
+  </PropertyGroup>
+
+  <!-- Installer versions -->
+  <PropertyGroup>
+    <!-- CLI would take a dependency such as 'aspnetcore-runtime-M.N >= M.N.P'. Here M.N is part of the id and M.N.P is the PackageVersion -->
+    <PackageId>$(RuntimeInstallerBaseName)-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</PackageId>
+
+    <!-- PackageVersion does not match the ASP.NET Core runtime verison. -->
+    <PackageVersion>$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion)</PackageVersion>
+    <!-- Deb installers are versioned as M.N.P~Build following the core-setup convention -->
+    <PackageVersion Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">$(PackageVersion)~$(BuildNumber)</PackageVersion>
+    <PackageRevision>1</PackageRevision>
+
+    <!-- Needed some creativity to convert the PackageVersion M.N.P-Build to the installer version M.N.P~Build, The conditional handles stabilized builds -->
+    <DotnetRuntimeDependencyVersion>$(MicrosoftNETCoreAppPackageVersion)</DotnetRuntimeDependencyVersion>
+    <DotnetRuntimeDependencyVersion Condition="$(DotnetRuntimeDependencyVersion.Contains('-'))">$(DotnetRuntimeDependencyVersion.Substring(0, $(DotnetRuntimeDependencyVersion.IndexOf('-'))))~$(DotnetRuntimeDependencyVersion.Substring($([MSBuild]::Add($(DotnetRuntimeDependencyVersion.IndexOf('-')), 1))))</DotnetRuntimeDependencyVersion>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\..\Framework\**\Microsoft.AspNetCore.All.shfxproj">
+      <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
+      <OutputItemType>_ResolvedFxProjects</OutputItemType>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Framework\**\Microsoft.AspNetCore.App.shfxproj">
+      <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
+      <OutputItemType>_ResolvedFxProjects</OutputItemType>
+    </ProjectReference>
+  </ItemGroup>
+
+  <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
+
+  <Target Name="GetTargetPath" Returns="$(TargetPath)" />
+
+  <Target Name="PrepareForBuild">
+    <Error Text="Currently only linux-x64 is supported by Debian installers." Condition=" '$(SharedFxRid)' != 'linux-x64' " />
+
+    <MakeDir Directories="$(IntermediateOutputPath);$(IntermediatePackageRoot);$(OutputPath)" />
+  </Target>
+
+  <Target Name="Build" DependsOnTargets="PrepareForBuild;ResolveProjectReferences;GetTargetPath">
+
+    <!-- Layout files in package_root/ for the build.sh script. -->
+    <ItemGroup>
+      <SharedFxAssetFolder Include="%(_ResolvedFxProjects.InstallerAssetPaths)" SharedFxName="%(_ResolvedFxProjects.SharedFxName)" />
+      <PackageFiles Include="%(SharedFxAssetFolder.Identity)\**\*">
+        <DestinationDir>$(IntermediatePackageRoot)shared\%(SharedFxAssetFolder.SharedFxName)\$(SharedFxVersion)\</DestinationDir>
+      </PackageFiles>
+    </ItemGroup>
+
+    <Copy SourceFiles="@(PackageFiles)" DestinationFiles="@(PackageFiles->'%(DestinationDir)%(RecursiveDir)%(FileName)%(Extension)')" />
+
+    <!-- Generate debian_config.json. We can't simply use WriteLinesToFile because of https://github.com/Microsoft/msbuild/issues/1622. Use our custom GenerateFileFromTemplate task instead -->
+    <PropertyGroup>
+      <DebianConfigProperties>
+        AspNetCoreMajorVersion=$(AspNetCoreMajorVersion);
+        AspNetCoreMinorVersion=$(AspNetCoreMinorVersion);
+        Authors=$(Authors);
+        DebianPackageInstallRoot=$(DebianPackageInstallRoot);
+        DotnetRuntimeDependencyVersion=$(DotnetRuntimeDependencyVersion);
+        MaintainerEmail=$(MaintainerEmail);
+        PackageId=$(PackageId);
+        PackageLicenseType=$(PackageLicenseType);
+        PackageProjectUrl=$(PackageProjectUrl);
+        PackageRevision=$(PackageRevision);
+        PackageVersion=$(PackageVersion);
+        SharedFxDescription=$(SharedFxDescription);
+        SharedFxProductName=$(SharedFxProductName);
+      </DebianConfigProperties>
+    </PropertyGroup>
+
+    <GenerateFileFromTemplate TemplateFile="debian_config.json.in"
+      Properties="$(DebianConfigProperties)"
+      OutputPath="$(IntermediateOutputPath)debian_config.json" />
+
+    <!-- Build SharedFx Bundle Deb package -->
+
+    <Exec Command="./build.sh -i '$(IntermediateOutputPath)' -o '$(IntermediateOutputPath)out/'" />
+
+    <PropertyGroup>
+      <!-- Map our RIDs to the arch names used by debuild. -->
+      <DebArch Condition=" '$(SharedFxRid)' == 'linux-x64' ">amd64</DebArch>
+      <BuildScriptOutputFileName>$(PackageId)_$(PackageVersion)-$(PackageRevision)_$(DebArch).deb</BuildScriptOutputFileName>
+    </PropertyGroup>
+
+    <Copy SourceFiles="$(IntermediateOutputPath)out/$(BuildScriptOutputFileName)" DestinationFiles="$(TargetPath)" />
+  </Target>
+</Project>

+ 36 - 0
src/Installers/Debian/debian_config.json.in

@@ -0,0 +1,36 @@
+{
+  "maintainer_name": "${Authors}",
+  "maintainer_email": "${MaintainerEmail}",
+
+  "package_name": "${PackageId}",
+  "install_root": "${DebianPackageInstallRoot}",
+
+  "short_description": "${SharedFxProductName}",
+  "long_description": "${SharedFxDescription}",
+  "homepage": "${PackageProjectUrl}",
+
+  "release":{
+    "package_version":"${PackageVersion}",
+    "package_revision":"${PackageRevision}",
+    "urgency" : "low",
+    "changelog_message" : ""
+  },
+
+  "control": {
+    "priority":"standard",
+    "section":"devel",
+    "architecture":"any"
+  },
+
+  "copyright": "Microsoft",
+  "license": {
+    "type": "${PackageLicenseType}",
+    "full_text": "Copyright (c) .NET Foundation. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthese files except in compliance with the License. You may obtain a copy of the\nLicense at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed\nunder the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\nCONDITIONS OF ANY KIND, either express or implied. See the License for the\nspecific language governing permissions and limitations under the License."
+  },
+
+  "debian_dependencies": {
+    "dotnet-runtime-${AspNetCoreMajorVersion}.${AspNetCoreMinorVersion}": {
+      "package_version": "${DotnetRuntimeDependencyVersion}"
+    }
+  }
+}

+ 42 - 0
src/Installers/Rpm/Rpm.props

@@ -0,0 +1,42 @@
+<!--
+  Common properties for building RPM installers.
+-->
+<Project>
+
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
+
+  <!-- Output paths -->
+  <PropertyGroup>
+    <BaseIntermediateOutputPath>$(RepositoryRoot)obj\Rpm\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
+    <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(SharedFxRid)\</IntermediateOutputPath>
+    <IntermediatePackageRoot>$([MSBuild]::NormalizeDirectory('$(IntermediateOutputPath)content/'))</IntermediatePackageRoot>
+    <OutputPath>$(InstallersOutputPath)</OutputPath>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <!-- installer versions -->
+    <!-- CLI would take a dependency such as 'aspnetcore-runtime-M.N >= M.N.P'. Here M.N is the part of the id and M.N.P is the package version -->
+    <PackageId>$(RuntimeInstallerBaseName)-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</PackageId>
+    <PackageVersion>$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion)</PackageVersion>
+
+    <!-- Set package revision to '1' for RTM releases, but include the build number in pre-releases -->
+    <PackageRevision Condition=" '$(IncludePreReleaseLabelInPackageVersion)' != 'true' ">1</PackageRevision>
+    <PackageRevision Condition=" '$(IncludePreReleaseLabelInPackageVersion)' == 'true' ">0.1.$(PreReleaseLabel)_$(BuildNumber.Replace('-', '_'))</PackageRevision>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\..\Framework\**\Microsoft.AspNetCore.All.shfxproj">
+      <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
+      <OutputItemType>_ResolvedFxProjects</OutputItemType>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Framework\**\Microsoft.AspNetCore.App.shfxproj">
+      <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
+      <OutputItemType>_ResolvedFxProjects</OutputItemType>
+    </ProjectReference>
+
+    <InstallerOwnedDirectory Include="$(RpmPackageInstallRoot)shared/Microsoft.AspNetCore.All" />
+    <InstallerOwnedDirectory Include="$(RpmPackageInstallRoot)shared/Microsoft.AspNetCore.App" />
+    <RpmDependency Include="dotnet-runtime-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)" Version="$(MicrosoftNETCoreAppPackageVersion.Split('-')[0])" />
+  </ItemGroup>
+
+</Project>

+ 78 - 0
src/Installers/Rpm/Rpm.targets

@@ -0,0 +1,78 @@
+<!--
+  Common targets for building RPM.
+-->
+<Project>
+  <UsingTask Condition=" '$(BuildToolsTaskAssembly)' != '' AND Exists('$(BuildToolsTaskAssembly)') " TaskName="Microsoft.AspNetCore.BuildTools.GenerateFileFromTemplate" AssemblyFile="$(BuildToolsTaskAssembly)" />
+  <UsingTask Condition=" '$(BuildToolsTaskAssembly)' != '' AND Exists('$(BuildToolsTaskAssembly)') " TaskName="Microsoft.AspNetCore.BuildTools.Run" AssemblyFile="$(BuildToolsTaskAssembly)" />
+
+  <!-- Output paths -->
+  <PropertyGroup>
+    <RpmPackageInstallRoot Condition="'$(RpmPackageInstallRoot)' != '' AND !HasTrailingSlash('$(RpmPackageInstallRoot)')">$(RpmPackageInstallRoot)/</RpmPackageInstallRoot>
+    <TargetPath>$(InstallersOutputPath)$(OutputFileName)</TargetPath>
+  </PropertyGroup>
+
+  <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
+
+  <Target Name="GetTargetPath" Returns="$(TargetPath)" />
+
+  <Target Name="PrepareForBuild">
+    <MakeDir Directories="$(IntermediateOutputPath);$(IntermediatePackageRoot)" />
+
+    <Error Text="Currently only linux-x64 is supported by Rpm installers." Condition=" '$(SharedFxRid)' != 'linux-x64' " />
+
+    <Error Text="Missing required property: RpmPackageInstallRoot" Condition=" '$(RpmPackageInstallRoot)' == '' " />
+  </Target>
+
+  <Target Name="Build" DependsOnTargets="PrepareForBuild;ResolveProjectReferences;GetTargetPath">
+    <!-- Layout files in package_root/ for the build.sh script. -->
+    <ItemGroup>
+      <SharedFxAssetFolder Include="%(_ResolvedFxProjects.InstallerAssetPaths)" SharedFxName="%(_ResolvedFxProjects.SharedFxName)" />
+      <PackageFiles Include="%(SharedFxAssetFolder.Identity)\**\*">
+        <DestinationDir>$(IntermediatePackageRoot)shared\%(SharedFxAssetFolder.SharedFxName)\$(SharedFxVersion)\</DestinationDir>
+      </PackageFiles>
+    </ItemGroup>
+
+    <Copy SourceFiles="@(PackageFiles)" DestinationFiles="@(PackageFiles->'%(DestinationDir)%(RecursiveDir)%(FileName)%(Extension)')" />
+
+    <!-- Create layout: Create changelog -->
+    <PropertyGroup>
+      <ChangeLogProps>DATE=$([System.DateTime]::UtcNow.ToString(ddd MMM dd yyyy))</ChangeLogProps>
+      <ChangeLogProps>$(ChangeLogProps);MAINTAINER_NAME=$(Authors)</ChangeLogProps>
+      <ChangeLogProps>$(ChangeLogProps);MAINTAINER_EMAIL=$(MaintainerEmail)</ChangeLogProps>
+      <ChangeLogProps>$(ChangeLogProps);PACKAGE_VERSION=$(PackageVersion)</ChangeLogProps>
+      <ChangeLogProps>$(ChangeLogProps);PACKAGE_REVISION=$(PackageRevision)</ChangeLogProps>
+
+      <GeneratedChangeLog>$(IntermediateOutputPath)changelog</GeneratedChangeLog>
+    </PropertyGroup>
+
+    <GenerateFileFromTemplate TemplateFile="$(MSBuildThisFileDirectory)changelog.in" OutputPath="$(GeneratedChangeLog)" Properties="$(ChangeLogProps)" />
+
+    <!-- Run fpm -->
+    <PropertyGroup>
+      <RpmArch Condition=" '$(SharedFxRid)' == 'linux-x64' ">amd64</RpmArch>
+    </PropertyGroup>
+
+    <ItemGroup>
+      <FpmArgs Include="--verbose" />
+      <FpmArgs Include="--input-type;dir" />
+      <FpmArgs Include="--output-type;rpm" />
+      <FpmArgs Include="--name;$(PackageId)" />
+      <FpmArgs Include="--package;$(TargetPath)" />
+      <FpmArgs Include="--version;$(PackageVersion)" />
+      <FpmArgs Include="--iteration;$(PackageRevision)" />
+      <FpmArgs Include="--architecture;$(RpmArch)" />
+      <FpmArgs Include="--depends;%(RpmDependency.Identity) &gt;= %(RpmDependency.Version)" Condition=" '%(RpmDependency.Identity)' != '' "  />
+      <FpmArgs Include="--rpm-changelog;$(GeneratedChangeLog)" />
+      <FpmArgs Include="--rpm-summary;$(SharedFxProductName)" />
+      <FpmArgs Include="--description;$(SharedFxDescription)" />
+      <FpmArgs Include="--maintainer;$(Authors) &lt;$(MaintainerEmail)&gt;" />
+      <FpmArgs Include="--vendor;$(RpmPackageVendor)" />
+      <FpmArgs Include="--license;$(PackageLicenseType)" />
+      <FpmArgs Include="--url;$(PackageProjectUrl)" />
+      <FpmArgs Include="--directories;%(InstallerOwnedDirectory.Identity)" Condition=" '%(InstallerOwnedDirectory.Identity)' != '' " />
+      <FpmArgs Include="$(IntermediatePackageRoot)=$(RpmPackageInstallRoot)" />
+    </ItemGroup>
+
+    <Run FileName="fpm" Arguments="@(FpmArgs)" />
+  </Target>
+</Project>

+ 13 - 0
src/Installers/Rpm/Runtime.Generic.rpmproj

@@ -0,0 +1,13 @@
+<!--
+  This project produces a generic RPM installer for Linux x64 platforms only.
+-->
+<Project DefaultTargets="Build">
+  <Import Project="Rpm.props" />
+
+  <PropertyGroup>
+    <RpmPackageInstallRoot>/usr/share/dotnet/</RpmPackageInstallRoot>
+    <OutputFileName>$(RuntimeInstallerBaseName)-$(SharedFxVersion)-x64.rpm</OutputFileName>
+  </PropertyGroup>
+
+  <Import Project="Rpm.targets" />
+</Project>

+ 13 - 0
src/Installers/Rpm/Runtime.Rhel.rpmproj

@@ -0,0 +1,13 @@
+<!--
+  This project produces a RPM RHEL.7 installer for Linux x64 platforms only.
+-->
+<Project DefaultTargets="Build">
+  <Import Project="Rpm.props" />
+
+  <PropertyGroup>
+    <RpmPackageInstallRoot>/opt/rh/rh-dotnet20/root/usr/lib64/dotnet/</RpmPackageInstallRoot>
+    <OutputFileName>$(RuntimeInstallerBaseName)-$(SharedFxVersion)-rh.rhel.7-x64.rpm</OutputFileName>
+  </PropertyGroup>
+
+  <Import Project="Rpm.targets" />
+</Project>

+ 0 - 0
build/tools/packaging/changelog.in → src/Installers/Rpm/changelog.in


+ 2 - 0
version.props

@@ -24,6 +24,8 @@
     <PackageVersion>$(VersionPrefix)</PackageVersion>
     <PackageVersion Condition=" '$(IncludePreReleaseLabelInPackageVersion)' == 'true' ">$(VersionPrefix)-$(VersionSuffix)</PackageVersion>
 
+    <SharedFxVersion>$(PackageVersion)</SharedFxVersion>
+
     <!-- Experimental packages which are not truly supported yet. -->
     <ExperimentalPackageVersion>$(ExperimentalVersionPrefix)</ExperimentalPackageVersion>
     <ExperimentalPackageVersion  Condition=" '$(IncludePreReleaseLabelInPackageVersion)' == 'true' ">$(ExperimentalVersionPrefix)-$(VersionSuffix)</ExperimentalPackageVersion>