diff --git a/.azure/pipelines/ci-official.yml b/.azure/pipelines/ci-official.yml index e23c1fa545..411508e69f 100644 --- a/.azure/pipelines/ci-official.yml +++ b/.azure/pipelines/ci-official.yml @@ -6,6 +6,8 @@ trigger: exclude: - release/2.0 +name: $(Date:yyMMdd)-$(Rev:rr) + phases: - phase: Windows queue: @@ -42,6 +44,8 @@ phases: displayName: Build NuGet packages and win-x64 runtime - script: build.cmd -ci /p:SkipTests=true /p:Configuration=$(BuildConfiguration) /p:BuildNumber=$(Build.BuildNumber) /t:BuildSharedFx /p:SharedFxRID=win-x86 displayName: Build win-x86 runtime + - script: build.cmd -ci /p:SkipTests=true /p:Configuration=$(BuildConfiguration) /p:BuildNumber=$(Build.BuildNumber) /t:BuildSharedFx /p:SharedFxRID=win-arm + displayName: Build win-arm runtime - powershell: > src/Installers/Windows/clone_and_build_ancm.ps1 -GitCredential '$(dn-bot-devdiv-build-rw-code-rw)' diff --git a/.azure/pipelines/site-extensions.yml b/.azure/pipelines/site-extensions.yml index 84a4b2f0d8..c909102670 100644 --- a/.azure/pipelines/site-extensions.yml +++ b/.azure/pipelines/site-extensions.yml @@ -2,6 +2,9 @@ trigger: branches: include: - release/2.2 + paths: + include: + - src/SiteExtensions name: $(Date:yyMMdd)-$(Rev:rr) diff --git a/.editorconfig b/.editorconfig index 4eb7559fce..35147d7db8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,7 +11,7 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -[*.{cs}] +[*.cs] indent_size = 4 dotnet_sort_system_directives_first = true:warning diff --git a/Directory.Build.props b/Directory.Build.props index 813f3db1f2..fea1bad021 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,12 +3,32 @@ Microsoft ASP.NET Core + + Microsoft + Microsoft Corporation. + © Microsoft Corporation. All rights reserved. + en-US + https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt + https://go.microsoft.com/fwlink/?LinkID=288859 + https://asp.net + true + true + $(MSBuildThisFileDirectory) https://github.com/aspnet/AspNetCore git + $(MSBuildThisFileDirectory)eng\AspNetCore.snk true true + + + SHA256 + + true + + + false @@ -17,12 +37,31 @@ $(RepositoryRoot)artifacts\ $(ArtifactsDir)obj\ + Debug $(ArtifactsDir)$(Configuration)\ $(ArtifactsConfigurationDir)bin\ - $(ArtifactsConfigurationDir)packages\ + $(ArtifactsConfigurationDir)installers\ + $(ArtifactsDir)build\ + + + win-x64 + osx-x64 + linux-x64 + + + + win-x64; + win-x86; + win-arm; + osx-x64; + linux-musl-x64; + linux-x64; + linux-arm + - + + diff --git a/Directory.Build.targets b/Directory.Build.targets index 6bd26321ea..63da83a65e 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -9,6 +9,7 @@ 99.9 - + + diff --git a/Microsoft.AspNetCore.sln b/Microsoft.AspNetCore.sln deleted file mode 100644 index 809b017e25..0000000000 --- a/Microsoft.AspNetCore.sln +++ /dev/null @@ -1,39 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EE2CAA71-82AA-41C0-AE87-5B4FB77D6CFE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedFx.UnitTests", "test\SharedFx.UnitTests\SharedFx.UnitTests.csproj", "{99CC38EC-902B-4B3F-AD33-177018110199}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|Any CPU.Build.0 = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|x64.ActiveCfg = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|x64.Build.0 = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|x86.ActiveCfg = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|x86.Build.0 = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|Any CPU.ActiveCfg = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|Any CPU.Build.0 = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|x64.ActiveCfg = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|x64.Build.0 = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|x86.ActiveCfg = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {99CC38EC-902B-4B3F-AD33-177018110199} = {EE2CAA71-82AA-41C0-AE87-5B4FB77D6CFE} - EndGlobalSection -EndGlobal diff --git a/build/SharedFx.props b/build/SharedFx.props index ca4aba4602..bc05e05024 100644 --- a/build/SharedFx.props +++ b/build/SharedFx.props @@ -1,5 +1,9 @@ + win-x64 + osx-x64 + linux-x64 + <_WorkRoot>$(RepositoryRoot).w\$(SharedFxRID)\ <_WorkLayoutDir>$(_WorkRoot).l\ @@ -13,17 +17,10 @@ <_SymbolsSourceDir>$(RepositoryRoot).deps\symbols\ <_DockerRootDir>/opt/code/ <_InstallersOutputDir>$(ArtifactsDir)installers\ - - : - %3B + .tar.gz .zip - lib - .so - .dll - .dylib - .exe netcoreapp3.0 @@ -68,7 +65,7 @@ - + diff --git a/build/SharedFx.targets b/build/SharedFx.targets index 9987e815a5..f70618067c 100644 --- a/build/SharedFx.targets +++ b/build/SharedFx.targets @@ -2,558 +2,69 @@ - $([MSBuild]::NormalizeDirectory($(ArtifactsDir)))runtime\ + $(RepositoryRoot)src\Framework\Framework.UnitTests\Framework.UnitTests.csproj + $([MSBuild]::NormalizePath($(UnitTestFxProject))) - - - <_MetapackageProject Include="$(RepositoryRoot)src\Packages\Microsoft.AspNetCore.All\Microsoft.AspNetCore.All.csproj" /> - <_MetapackageProject Include="$(RepositoryRoot)src\Packages\Microsoft.AspNetCore.App\Microsoft.AspNetCore.App.csproj" /> - <_MetapackageProject Include="$(RepositoryRoot)src\Packages\Microsoft.AspNetCore.Analyzers\Microsoft.AspNetCore.Analyzers.csproj" /> - + + + + + + + - - - + - - - <_SharedFrameworkSymbolsPackage Include="@(SharedFrameworkName)" Condition="'%(AllSharedFxRIDs.CrossgenSymbols)' != 'false' AND '%(AllSharedFxRIDs.Crossgen)' != 'false'"> - %(AllSharedFxRIDs.Identity) - - <_SharedFrameworkSymbolsPackage Update="@(_SharedFrameworkSymbolsPackage)" PackageId="runtime.%(Rid).%(Identity)" /> - - NuGetSymbolsPackage - %(_SharedFrameworkSymbolsPackage.PackageId) - $(PackageVersion) - shipoob - - - + - - $(_MetapackageSrcRoot)$(MetapackageName)\ - $(_WorkRoot)pkg\$(MetapackageName)\ - - $(CommonProps);Configuration=$(Configuration) - $(CommonProps);DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath) - $(CommonProps);DotNetBuildOffline=true - $(CommonProps);AspNetUniverseBuildOffline=true - $(CommonProps);RuntimeFrameworkVersion=$(MicrosoftNETCoreApp30PackageVersion) - $(CommonProps);AppMetapackageVersion=$(PackageVersion) + <_RestoreGraphProjectInput>@(ProjectToBuild) + + $(SolutionProperties); + SharedFxRid=$(SharedFxRid); + DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath); + DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath) + - + - - - + - - - - - - - - - - - - - - + - - - <_MetapackageBuilderProject Include="$(MSBuildProjectFullPath)"> - - MetapackageName=Microsoft.AspNetCore.App; - MetapackageReferenceType=AppMetapackage; - MetapackageDependencyVersionRangeType=MajorMinor - - - - <_MetapackageBuilderProject Include="$(MSBuildProjectFullPath)"> - - MetapackageName=Microsoft.AspNetCore.All; - MetapackageReferenceType=AllMetapackage; - MetapackageDependencyVersionRangeType=Minimum - - - - <_MetapackageBuilderProject Include="$(MSBuildProjectFullPath)"> - - MetapackageName=Microsoft.AspNetCore.Analyzers; - MetapackageReferenceType=Analyzer; - MetapackageDependencyVersionRangeType=Minimum - - - - - - - - + - true - false - true - false - true - - - - - - $(_WorkRoot)AppSharedFx\ - $(_WorkRoot)AllSharedFx\ - $(_WorkRoot)Publish\ - $(_WorkRoot)CrossGen\ - $(_WorkRoot)CrossGenSymbols\ - $(_WorkRoot)CrossGenTool\ - $(_WorkRoot)CrossGenRsp\ - $(SharedFxIntermediateOutputPath)shared\Microsoft.AspNetCore.App\$(PackageVersion)\ - $(SharedFxIntermediateOutputPath)shared\Microsoft.AspNetCore.All\$(PackageVersion)\ - $(SharedFxRID) - - - : - %3B - - Configuration=$(Configuration);RuntimeIdentifier=$(SharedFxRestoreRid) - $(CommonSharedFxProps);DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath) - $(CommonSharedFxProps);DotNetBuildOffline=true - $(CommonSharedFxProps);AspNetUniverseBuildOffline=true - - - - - - $(CommonSharedFxProps) - $(RestoreProps);SharedFxPackage=$(SharedFxPackage) - $(RestoreProps);SharedFxPackageVersion=$(PackageVersion) - $(RestoreProps);SharedFxBase=$(SharedFxBase) - $(RestoreProps);SharedFxBaseVersion=$(SharedFxBaseVersion) - - - - - - - - - - - - - - - - RepositoryCommit=$(RepositoryCommit);SharedFxWorkDirectory=$(AppSharedFxWorkDirectory) - $(AppSharedFxProps);RuntimeFrameworkVersion=$(MicrosoftNETCoreApp30PackageVersion) - $(AppSharedFxProps);SharedFxPackage=Microsoft.AspNetCore.App - RepositoryCommit=$(RepositoryCommit);SharedFxWorkDirectory=$(AllSharedFxWorkDirectory) - $(AllSharedFxProps);RuntimeFrameworkVersion=$(MicrosoftNETCoreApp30PackageVersion) - $(AllSharedFxProps);SharedFxPackage=Microsoft.AspNetCore.All - $(AllSharedFxProps);SharedFxDep=Microsoft.AspNetCore.App - $(AllSharedFxProps);SharedFxDepVersion=$(PackageVersion) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - win - linux - osx - - - - - - - - - - - - - - - SharedFxPackage=Microsoft.AspNetCore.App - $(AppSharedFxProps);SharedFxWorkDirectory=$(AppSharedFxWorkDirectory) - $(AppSharedFxProps);SharedFxPublishDirectory=$(AppSharedFxPublishDirectory) - SharedFxPackage=Microsoft.AspNetCore.All - $(AllSharedFxProps);SharedFxWorkDirectory=$(AllSharedFxWorkDirectory) - $(AllSharedFxProps);SharedFxPublishDirectory=$(AllSharedFxPublishDirectory) - - - - - - - - - - - Microsoft.NETCore.App - crossgen - $(CrossGenTool).exe - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_AppRuntimeAssemblies Include="@(AppPublishAssemblies)" Condition="'%(AssetType)' == 'runtime'"> - %(PackageName).%(PackageVersion).symbols.nupkg - %(RootDir)%(Directory)%(Filename).pdb - - <_AllRuntimeAssemblies Include="@(AllPublishAssemblies)" Exclude="@(_AppRuntimeAssemblies)" Condition="'%(AssetType)' == 'runtime'"> - %(PackageName).%(PackageVersion).symbols.nupkg - %(RootDir)%(Directory)%(Filename).pdb - - - <_AssembliesToCrossgen Include="$(SharedFxIntermediateOutputPath)**\*.dll" /> - - - - - - - - - - - - - - - - - - - - %(FullPath) - $(SharedFxCrossGenRspDirectory)%(RecursiveDir)%(Filename).rsp - $(SharedFxCrossGenRspDirectory)%(RecursiveDir)%(Filename).symbols.rsp - $(SharedFxCrossGenDirectory)%(RecursiveDir)%(Filename)%(Extension) - $(SharedFxCrossGenDirectory)%(RecursiveDir) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CreatePerfMap - CreatePDB - - - - - - - - - - - - - - - - - - - - runtime.$(SharedFxRID).$(SymbolsNuspecIdSuffix) - - - - <_SymbolFiles Include="$(SymbolsWorkDir)**\*.pdb;$(SymbolsWorkDir)**\*.map;$(SymbolsWorkDir)**\*.dll" /> - - %(RecursiveDir)%(Filename)%(Extension) - - - - - - - - - - - - - $(SharedFxCrossGenDirectory)shared\Microsoft.AspNetCore.App\$(PackageVersion)\ - $(SharedFxCrossGenDirectory)shared\Microsoft.AspNetCore.All\$(PackageVersion)\ - $(_WorkRoot)Symbols\Microsoft.AspNetCore.App\ - $(_WorkRoot)Symbols\Microsoft.AspNetCore.All\ - - - - - - - - - - - - - - - - - - - - - - - - - - SymbolsWorkDir=$(AppSharedFxSymbolsDirectory) - $(AppSymbolsArguments);SymbolsNuspecIdSuffix=Microsoft.AspNetCore.App - $(AppSymbolsArguments);Description=Symbol packages for Microsoft.AspNetCore.App shared framework - SymbolsWorkDir=$(AllSharedFxSymbolsDirectory) - $(AllSymbolsArguments);SymbolsNuspecIdSuffix=Microsoft.AspNetCore.All - $(AllSymbolsArguments);Description=Symbol packages for Microsoft.AspNetCore.All shared framework - - - - - - - - - - - - - - - - - - - - - - - $(RepositoryRoot)\test\SharedFx.UnitTests\SharedFx.UnitTests.csproj $(LogOutputDir)SharedFx-UnitTests-$(Version).trx $(UnitTestFxTrxLogFile) $(HostMachineRepositoryRoot)/artifacts/logs/SharedFx-UnitTests.trx - - - DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath); - DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath); - SharedFxOutputPath=$(SharedFxIntermediateOutputPath); - RepositoryCommit=$(RepositoryCommit); - VSTestLogger=$([MSBuild]::Escape('trx;LogFileName=$(UnitTestFxTrxLogFile)')); - SharedFxRuntimeIdentifier=$(SharedFXRid) - - - + + - + --;RunConfiguration.NoAutoReporters=true"> diff --git a/build/SharedFxInstaller.targets b/build/SharedFxInstaller.targets index 50cfb4d5a5..84de47a045 100644 --- a/build/SharedFxInstaller.targets +++ b/build/SharedFxInstaller.targets @@ -1,5 +1,5 @@ - + @@ -13,72 +13,8 @@ Text="Docker host must be using Linux containers." Condition="'$(DockerHostOS)' != 'linux'"/> - - - - - - - - - - - - - .tar.gz - .zip - - - - - - - - - - - - - - - - - - - - - - - + Text="Expected archive missing at $(SharedFxIntermediateArchiveFilePrefix)-linux-x64.tar.gz." + Condition="!Exists('$(SharedFxIntermediateArchiveFilePrefix)-linux-x64.tar.gz')" /> @@ -113,7 +49,7 @@ diff --git a/build/artifacts.props b/build/artifacts.props index babf8b610d..bb7c26e0cc 100644 --- a/build/artifacts.props +++ b/build/artifacts.props @@ -2,18 +2,13 @@ - - false - - false - - false - - Dependency + @@ -23,73 +18,74 @@ - + - - - + + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - + - + - + - - + + - - - - + + + + - - - + + + - - - - - - - + + + + + + + - + @@ -99,160 +95,160 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - + - + - - + + - - - + + + - - - - - - + + + + + + - - - - + + + + - - - - - - - + + + + + + + - - - + + + - + - - - - + + + + - - - + + + - + - - + + - - - - - - + + + + + + - + - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - + + + + + - - + + diff --git a/build/dependencies.props b/build/dependencies.props index 438ffbefda..7e1fd426ec 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,4 +1,4 @@ - + 4.6.0-preview1-26907-04 @@ -60,6 +60,8 @@ $(MicrosoftNETCoreAppPackageVersion) + + $(MicrosoftNETCoreApp30PackageVersion) $(KoreBuildVersion) diff --git a/build/external-dependencies.props b/build/external-dependencies.props index 8f71ea3ac8..b1cafe8da4 100644 --- a/build/external-dependencies.props +++ b/build/external-dependencies.props @@ -5,54 +5,37 @@ - - false - - false - - - - - - - false - - false - true - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - @@ -64,7 +47,7 @@ - + @@ -117,6 +100,8 @@ + + @@ -196,7 +181,7 @@ - + diff --git a/build/repo.beforecommon.props b/build/repo.beforecommon.props deleted file mode 100644 index f470e9b2a6..0000000000 --- a/build/repo.beforecommon.props +++ /dev/null @@ -1,10 +0,0 @@ - - - - true - - diff --git a/build/repo.props b/build/repo.props index 7c8a1ccfe8..3d9c7d647b 100644 --- a/build/repo.props +++ b/build/repo.props @@ -18,6 +18,7 @@ + @@ -28,6 +29,7 @@ + diff --git a/build/repo.targets b/build/repo.targets index 3b704e89d5..ae5cdc3aec 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -15,8 +15,8 @@ SetTeamCityBuildNumberToVersion;$(PrepareDependsOn);VerifyPackageArtifactConfig;VerifyExternalDependencyConfig;PrepareOutputPaths $(CleanDependsOn);CleanArtifacts;CleanRepoArtifacts $(RestoreDependsOn);InstallDotNet - $(CompileDependsOn);BuildRepositories - $(PackageDependsOn);BuildMetapackages;CheckExpectedPackagesExist + $(CompileDependsOn);BuildRepositories;BuildSharedFx + $(PackageDependsOn);CheckExpectedPackagesExist $(TestDependsOn);_TestRepositories $(GetArtifactInfoDependsOn);ResolveRepoInfo @@ -25,7 +25,7 @@ - + MicrosoftNETCoreAppPackageVersion=$(MicrosoftNETCoreAppPackageVersion); @@ -43,6 +43,14 @@ + + + + - - - - - - - - diff --git a/build/sources.props b/build/sources.props index a1c737dfd4..a0dc3be95f 100644 --- a/build/sources.props +++ b/build/sources.props @@ -28,5 +28,10 @@ $(RestoreSources); https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; + + https://dotnetcli.blob.core.windows.net/dotnet/ + + + $(PublicCoreFeedPrefix) diff --git a/build/tasks/AddMetapackageReferences.cs b/build/tasks/AddMetapackageReferences.cs deleted file mode 100644 index 3cb11666ab..0000000000 --- a/build/tasks/AddMetapackageReferences.cs +++ /dev/null @@ -1,134 +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. - -using System; -using System.Linq; -using System.Xml; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NuGet.Versioning; -using RepoTasks.Utilities; - -namespace RepoTasks -{ - public class AddMetapackageReferences : Task - { - [Required] - public string ReferencePackagePath { get; set; } - - [Required] - public string MetapackageReferenceType { get; set; } - - [Required] - public string DependencyVersionRangeType { get; set; } - - // MSBuild doesn't allow binding to enums directly. - private enum VersionRangeType - { - Minimum, // [1.1.1, ) - MajorMinor, // [1.1.1, 1.2.0) - } - - [Required] - public ITaskItem[] PackageArtifacts { get; set; } - - [Required] - public ITaskItem[] ExternalDependencies { get; set; } - - public override bool Execute() - { - if (!Enum.TryParse(DependencyVersionRangeType, out var dependencyVersionType)) - { - Log.LogError("Unexpected value {0} for DependencyVersionRangeType", DependencyVersionRangeType); - return false; - } - - // Parse input - var metapackageArtifacts = PackageArtifacts.Where(p => p.GetMetadata(MetapackageReferenceType) == "true"); - var externalArtifacts = ExternalDependencies.Where(p => p.GetMetadata(MetapackageReferenceType) == "true"); - - var xmlDoc = new XmlDocument(); - xmlDoc.Load(ReferencePackagePath); - - // Project - var projectElement = xmlDoc.FirstChild; - - // Items - var itemGroupElement = xmlDoc.CreateElement("ItemGroup"); - Log.LogMessage(MessageImportance.High, $"{MetapackageReferenceType} will include the following packages"); - - foreach (var package in metapackageArtifacts) - { - var packageName = package.ItemSpec; - var packageVersion = package.GetMetadata("Version"); - if (string.IsNullOrEmpty(packageVersion)) - { - Log.LogError("Missing version information for package {0}", packageName); - continue; - } - - var packageVersionValue = GetDependencyVersion(dependencyVersionType, packageName, packageVersion); - Log.LogMessage(MessageImportance.High, $" - Package: {packageName} Version: {packageVersionValue}"); - - var packageReferenceElement = xmlDoc.CreateElement("PackageReference"); - packageReferenceElement.SetAttribute("Include", packageName); - packageReferenceElement.SetAttribute("Version", packageVersionValue); - packageReferenceElement.SetAttribute("PrivateAssets", "None"); - - itemGroupElement.AppendChild(packageReferenceElement); - } - - foreach (var package in externalArtifacts) - { - var packageName = package.ItemSpec; - var packageVersion = package.GetMetadata("Version"); - - if (string.IsNullOrEmpty(packageVersion)) - { - Log.LogError("Missing version information for package {0}", packageName); - continue; - } - - var packageVersionValue = - Enum.TryParse(package.GetMetadata("MetapackageVersionRangeType"), out var packageVersionType) - ? GetDependencyVersion(packageVersionType, packageName, packageVersion) - : GetDependencyVersion(dependencyVersionType, packageName, packageVersion); - - Log.LogMessage(MessageImportance.High, $" - Package: {packageName} Version: {packageVersionValue}"); - - var packageReferenceElement = xmlDoc.CreateElement("PackageReference"); - packageReferenceElement.SetAttribute("Include", packageName); - packageReferenceElement.SetAttribute("Version", packageVersionValue); - packageReferenceElement.SetAttribute("PrivateAssets", "None"); - - itemGroupElement.AppendChild(packageReferenceElement); - } - - projectElement.AppendChild(itemGroupElement); - - // Save updated file - xmlDoc.AppendChild(projectElement); - xmlDoc.Save(ReferencePackagePath); - - return !Log.HasLoggedErrors; - } - - private string GetDependencyVersion(VersionRangeType dependencyVersionType, string packageName, string packageVersion) - { - switch (dependencyVersionType) - { - case VersionRangeType.MajorMinor: - if (!NuGetVersion.TryParse(packageVersion, out var nugetVersion)) - { - Log.LogError("Invalid NuGet version '{0}' for package {1}", packageVersion, packageName); - return null; - } - return $"[{packageVersion}, {nugetVersion.Major}.{nugetVersion.Minor + 1}.0)"; - case VersionRangeType.Minimum: - return packageVersion; - default: - throw new NotImplementedException(); - } - } - } -} diff --git a/build/tasks/CheckVersionOverrides.cs b/build/tasks/CheckVersionOverrides.cs index ad75aa8b2b..a510a8b800 100644 --- a/build/tasks/CheckVersionOverrides.cs +++ b/build/tasks/CheckVersionOverrides.cs @@ -24,7 +24,7 @@ namespace RepoTasks var versionOverrides = ProjectRootElement.Open(DotNetPackageVersionPropsPath); var dependencies = ProjectRootElement.Open(DependenciesFile); var pinnedVersions = dependencies.PropertyGroups - .Where(p => !string.Equals("Package Versions: Auto", p.Label)) + .Where(p => string.Equals("Package Versions: Pinned", p.Label)) .SelectMany(p => p.Properties) .ToDictionary(p => p.Name, p => p.Value, StringComparer.OrdinalIgnoreCase); diff --git a/build/tasks/ProcessSharedFrameworkDeps.cs b/build/tasks/ProcessSharedFrameworkDeps.cs index 87250780a8..49189544f3 100644 --- a/build/tasks/ProcessSharedFrameworkDeps.cs +++ b/build/tasks/ProcessSharedFrameworkDeps.cs @@ -3,8 +3,10 @@ // Sourced from https://github.com/dotnet/core-setup/tree/be8d8e3486b2bf598ed69d39b1629a24caaba45e/tools-local/tasks, needs to be kept in sync using System; +using System.Collections.Generic; using System.IO; using System.Linq; +using System.Security.Cryptography; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Microsoft.Extensions.DependencyModel; @@ -14,7 +16,7 @@ using RepoTasks.Utilities; namespace RepoTasks { - public partial class ProcessSharedFrameworkDeps : Task + public class ProcessSharedFrameworkDeps : Task { [Required] public string AssetsFilePath { get; set; } @@ -22,6 +24,15 @@ namespace RepoTasks [Required] public string DepsFilePath { get; set; } + [Required] + public string OutputPath { get; set; } + + [Required] + public string FrameworkName { get; set; } + + // When generating the .deps.json file, these files are used to replace "project" libraries with "packages". + public ITaskItem[] ResolvedPackageProjectReferences { get; set; } + public string[] PackagesToRemove { get; set; } [Required] @@ -42,7 +53,7 @@ namespace RepoTasks context = new DependencyContextJsonReader().Read(depsStream); } - LockFile lockFile = LockFileUtilities.GetLockFile(AssetsFilePath, NullLogger.Instance); + var lockFile = LockFileUtilities.GetLockFile(AssetsFilePath, NullLogger.Instance); if (lockFile == null) { throw new ArgumentException($"Could not load a LockFile at '{AssetsFilePath}'.", nameof(AssetsFilePath)); @@ -52,25 +63,66 @@ namespace RepoTasks var graph = manager.Collect(lockFile); var expandedGraph = manager.Expand(graph, Runtime); - var trimmedRuntimeLibraries = context.RuntimeLibraries; + // Remove the runtime entry for the project which generates the original deps.json. For example, there is no Microsoft.AspNetCore.App.dll. + var trimmedRuntimeLibraries = RuntimeReference.RemoveSharedFxRuntimeEntry(context.RuntimeLibraries, FrameworkName); + + trimmedRuntimeLibraries = ResolveProjectsAsPackages(ResolvedPackageProjectReferences, trimmedRuntimeLibraries); if (PackagesToRemove != null && PackagesToRemove.Any()) { - trimmedRuntimeLibraries = RuntimeReference.RemoveReferences(context.RuntimeLibraries, PackagesToRemove); + trimmedRuntimeLibraries = RuntimeReference.RemoveReferences(trimmedRuntimeLibraries, PackagesToRemove); } context = new DependencyContext( context.Target, - context.CompilationOptions, - context.CompileLibraries, + CompilationOptions.Default, + Array.Empty(), trimmedRuntimeLibraries, expandedGraph ); - using (var depsStream = File.Create(DepsFilePath)) + using (var depsStream = File.Create(OutputPath)) { new DependencyContextWriter().Write(context, depsStream); } } + + private IEnumerable ResolveProjectsAsPackages(ITaskItem[] resolvedProjects, IEnumerable compilationLibraries) + { + var projects = resolvedProjects.ToDictionary(k => k.GetMetadata("PackageId"), k => k, StringComparer.OrdinalIgnoreCase); + + foreach (var library in compilationLibraries) + { + if (projects.TryGetValue(library.Name, out var project)) + { + Log.LogMessage("Replacing the library entry for {0}", library.Name); + + var packagePath = project.ItemSpec; + var packageId = library.Name; + var version = library.Version; + string packageHash; + using (var sha512 = SHA512.Create()) + { + packageHash = "sha512-" + sha512.ComputeHashAsBase64(File.OpenRead(packagePath), leaveStreamOpen: false); + } + + yield return new RuntimeLibrary("package", + library.Name, + library.Version, + packageHash, + library.RuntimeAssemblyGroups, + library.NativeLibraryGroups, + library.ResourceAssemblies, + library.Dependencies, + serviceable: true, + path: $"{library.Name}/{library.Version}".ToLowerInvariant(), + hashPath: $"{library.Name}.{library.Version}.nupkg.sha512".ToLowerInvariant()); + } + else + { + yield return library; + } + } + } } -} \ No newline at end of file +} diff --git a/build/tasks/RepoTasks.tasks b/build/tasks/RepoTasks.tasks index 5339c01d01..5df75df385 100644 --- a/build/tasks/RepoTasks.tasks +++ b/build/tasks/RepoTasks.tasks @@ -3,7 +3,6 @@ <_RepoTaskAssembly>$(MSBuildThisFileDirectory)bin\publish\RepoTasks.dll - @@ -12,9 +11,8 @@ + - - diff --git a/build/tasks/ResolveSymbolsRecursivePath.cs b/build/tasks/ResolveSymbolsRecursivePath.cs deleted file mode 100644 index 21dd795fcd..0000000000 --- a/build/tasks/ResolveSymbolsRecursivePath.cs +++ /dev/null @@ -1,29 +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. - -using System; -using System.IO; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using RepoTasks.Utilities; - -namespace RepoTasks -{ - public class ResolveSymbolsRecursivePath : Task - { - [Required] - [Output] - public ITaskItem[] Symbols { get; set; } - - public override bool Execute() - { - foreach (var symbol in Symbols) - { - var fullPath = symbol.GetMetadata("PortablePDB"); - symbol.SetMetadata("SymbolsRecursivePath", fullPath.Substring(fullPath.IndexOf($"{Path.DirectorySeparatorChar}lib{Path.DirectorySeparatorChar}"))); - } - - return true; - } - } -} diff --git a/build/tasks/ResolveVersionRange.cs b/build/tasks/ResolveVersionRange.cs new file mode 100644 index 0000000000..cedc94b404 --- /dev/null +++ b/build/tasks/ResolveVersionRange.cs @@ -0,0 +1,68 @@ +// 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. + +using System; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using NuGet.Versioning; +using RepoTasks.Utilities; + +namespace RepoTasks +{ + public class ResolveVersionRange : Task + { + [Required] + [Output] + public ITaskItem[] Items { get; set; } + + [Required] + public string Version { get; set; } + + [Required] + public string RangeType { get; set; } + + // MSBuild doesn't allow binding to enums directly. + private enum VersionRangeType + { + Minimum, // [1.1.1, ) + MajorMinor, // [1.1.1, 1.2.0) + } + + public override bool Execute() + { + if (!Enum.TryParse(RangeType, out var rangeType)) + { + Log.LogError("Unexpected value {0} for RangeType", RangeType); + return false; + } + + var versionRange = GetVersionRange(rangeType, Version); + + foreach (var item in Items) + { + item.SetMetadata("_OriginalVersion", Version); + item.SetMetadata("Version", versionRange); + } + + return !Log.HasLoggedErrors; + } + + private string GetVersionRange(VersionRangeType rangeType, string packageVersion) + { + switch (rangeType) + { + case VersionRangeType.MajorMinor: + if (!NuGetVersion.TryParse(packageVersion, out var nugetVersion)) + { + Log.LogError("Invalid NuGet version '{0}'", packageVersion); + return null; + } + return $"[{packageVersion}, {nugetVersion.Major}.{nugetVersion.Minor + 1}.0)"; + case VersionRangeType.Minimum: + return packageVersion; + default: + throw new NotImplementedException(); + } + } + } +} diff --git a/build/tasks/TrimDeps.cs b/build/tasks/TrimDeps.cs deleted file mode 100644 index b63bdb35cc..0000000000 --- a/build/tasks/TrimDeps.cs +++ /dev/null @@ -1,60 +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. - -using System.IO; -using System.Linq; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace RepoTasks -{ - public class TrimDeps : Task - { - [Required] - public ITaskItem[] DepsFiles { get; set; } - - public override bool Execute() - { - foreach (var depsFile in DepsFiles) - { - ChangeEntryPointLibraryName(depsFile.GetMetadata("Identity")); - } - - // Parse input - return true; - } - - - private void ChangeEntryPointLibraryName(string depsFile) - { - JToken deps; - using (var file = File.OpenText(depsFile)) - using (JsonTextReader reader = new JsonTextReader(file)) - { - deps = JObject.ReadFrom(reader); - } - - foreach (JProperty target in deps["targets"]) - { - var targetLibrary = target.Value.Children().FirstOrDefault(); - if (targetLibrary == null) - { - continue; - } - - targetLibrary.Remove(); - } - - var library = deps["libraries"].Children().First(); - library.Remove(); - - using (var file = File.CreateText(depsFile)) - using (var writer = new JsonTextWriter(file) { Formatting = Formatting.Indented }) - { - deps.WriteTo(writer); - } - } - } -} diff --git a/build/tasks/Utilities/RuntimeReference.cs b/build/tasks/Utilities/RuntimeReference.cs index 4907a73723..8f682eaa52 100644 --- a/build/tasks/Utilities/RuntimeReference.cs +++ b/build/tasks/Utilities/RuntimeReference.cs @@ -11,7 +11,30 @@ namespace RepoTasks.Utilities { internal class RuntimeReference { - public static List RemoveReferences(IReadOnlyList runtimeLibraries, IEnumerable packages) + public static IEnumerable RemoveSharedFxRuntimeEntry(IEnumerable runtimeLibraries, string fxName) + { + foreach (var runtimeLib in runtimeLibraries) + { + if (string.Equals(runtimeLib.Name, fxName, StringComparison.OrdinalIgnoreCase)) + { + yield return new RuntimeLibrary(runtimeLib.Type, + runtimeLib.Name, + runtimeLib.Version, + runtimeLib.Hash, + Array.Empty(), // runtimeLib.RuntimeAssemblyGroups, + runtimeLib.NativeLibraryGroups, + runtimeLib.ResourceAssemblies, + runtimeLib.Dependencies, + runtimeLib.Serviceable); + } + else + { + yield return runtimeLib; + } + } + } + + public static List RemoveReferences(IEnumerable runtimeLibraries, IEnumerable packages) { List result = new List(); @@ -60,4 +83,4 @@ namespace RepoTasks.Utilities return result; } } -} \ No newline at end of file +} diff --git a/build/tools/templates/SharedFx/SharedFx.csproj b/build/tools/templates/SharedFx/SharedFx.csproj deleted file mode 100644 index 8070ebbfe6..0000000000 --- a/build/tools/templates/SharedFx/SharedFx.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - netcoreapp3.0 - true - true - - - - - - - - - - - - - - - - - - - - diff --git a/build/tools/templates/SharedFxSymbols/SharedFrameworkSymbols.nuspec b/build/tools/templates/SharedFxSymbols/SharedFrameworkSymbols.nuspec deleted file mode 100644 index 1ba4b6c85d..0000000000 --- a/build/tools/templates/SharedFxSymbols/SharedFrameworkSymbols.nuspec +++ /dev/null @@ -1,18 +0,0 @@ - - - - $ID$ - $VERSION$ - $DESCRIPTION$ - Microsoft - Microsoft - Copyright © Microsoft Corporation - https://raw.githubusercontent.com/aspnet/Home/2.0.0/LICENSE.txt - https://go.microsoft.com/fwlink/?LinkID=288859 - https://asp.net - true - true - aspnetcore - - - diff --git a/eng/targets/SharedFx.Common.props b/eng/targets/SharedFx.Common.props new file mode 100644 index 0000000000..7f562c98f9 --- /dev/null +++ b/eng/targets/SharedFx.Common.props @@ -0,0 +1,36 @@ + + + + + true + + $(SharedFxRID) + $(HostRid) + $(RuntimeIdentifier) + + + true + + + true + + + true + + false + + + false + false + + + none + false + false + false + + + diff --git a/eng/targets/SharedFx.Common.targets b/eng/targets/SharedFx.Common.targets new file mode 100644 index 0000000000..4f83af1176 --- /dev/null +++ b/eng/targets/SharedFx.Common.targets @@ -0,0 +1,335 @@ + + + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + BuildOnlySettings; + PrepareForBuild; + PreBuildEvent; + ResolveReferences; + GenerateSharedFxVersionsFile; + PrepareForPublish; + ComputeAndCopyFilesToPublishDirectory; + GeneratePublishDependencyFile; + GenerateSharedFxDependencyFile; + GeneratePublishRuntimeConfigurationFile; + CopySharedFxToOutput; + CollectSharedFxOutput; + PostBuildEvent; + GetTargetPath; + + + + PrepareForCrossGen; + CrossGenAssemblies; + + + + $(CollectOutputSharedFxDependsOn); + CrossGenSymbols; + + + + PrepareOutputPaths; + + + + BeforeResolveReferences; + AssignProjectConfiguration; + ResolveProjectReferences; + FindInvalidProjectReferences; + AfterResolveReferences + + + + $(MSBuildProjectName) + + + win + osx + linux + linux-musl + unix + + lib + .so + .dll + .dylib + .exe + + : + %3B + + $(IntermediateOutputPath)$(SharedFxRid)\ + + + $(IntermediateOutputPath)u\ + + + false + + $(OutputPath)files\ + $(OutputPath)symbols\ + $(OutputPath)native\ + $(OutputPath)lib\$(TargetFramework)\ + + $(IntermediateOutputPath)crossgen\ + + + $(BaseSharedFrameworkName) + + $(IntermediateOutputPath)$(SharedFxName).runtimeconfig.dev.json + + $(IntermediateOutputPath)$(SharedFxName).project.deps.json + $(IntermediateOutputPath)$(SharedFxName).publish.deps.json + + + $(MetadataOutputPath)$(SharedFxName).runtimeconfig.json + $(MetadataOutputPath)$(SharedFxName).deps.json + $(MetadataOutputPath).version + + + + + + _ResolvedFrameworkProjectReferencePaths + + + + _ResolvedPackageProjectReferencePaths + + + + + + $(MetadataOutputPath); + $(RuntimeAssetsOutputPath); + $(NativeAssetsOutputPath); + + $(MetadataOutputPath) + $(RuntimeAssetsOutputPath) + $(NativeAssetsOutputPath) + $(SharedFxName) + $(PackageId) + + + + + + true + true + All + Native + true + + + + Runtime;Native + + + + + + + + + + + + + + <_UnknownRid Remove="@(_UnknownRid)" /> + <_UnknownRid Include="$(SharedFxRid)" Exclude="$(SupportedRuntimeIdentifiers)" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Microsoft.NETCore.App + crossgen + $(CrossGenTool).exe + + + + + + + + + + + + + + + + + + + + + + + + + + + + %(FullPath) + $(IntermediateOutputPath)%(RecursiveDir)%(Filename).rsp + $(IntermediateOutputPath)%(RecursiveDir)%(Filename).symbols.rsp + $(SymbolsOutputPath)%(RecursiveDir)%(Filename).ni.pdb + $(RuntimeAssetsOutputPath)%(RecursiveDir)%(Filename)%(Extension) + $(SymbolsOutputPath)%(RecursiveDir) + + + + + + + + + + <_PlatformAssemblyPaths Remove="@(_PlatformAssemblyPaths)" /> + <_PlatformAssemblyPaths Include="$(CrossGenToolDir)" /> + <_PlatformAssemblyPaths Include="$(PublishDir)" /> + <_PlatformAssemblyPaths Include="%(_ResolvedFrameworkProjectReferencePaths.RuntimeAssetsOutputPath)" Condition="'%(_ResolvedFrameworkProjectReferencePaths.RuntimeAssetsOutputPath)' != ''" /> + + + + @(_PlatformAssemblyPaths->Distinct(), '$(PathSeparator)') + + + + + + + + + + + + + + + + + + + + + + CreatePerfMap + CreatePDB + + + + + + + + + + + + + + + + + + + diff --git a/src/Framework/Directory.Build.props b/src/Framework/Directory.Build.props new file mode 100644 index 0000000000..5e777f75d6 --- /dev/null +++ b/src/Framework/Directory.Build.props @@ -0,0 +1,31 @@ + + + + + true + + $(RepositoryRoot)obj\pkg\$(MSBuildProjectName)\ + + + + + + + $(ArtifactsConfigurationDir)$(SharedFxRid)\$(MSBuildProjectName)\ + $(RepositoryRoot)obj\fx\$(MSBuildProjectName)\ + + false + false + + true + $(MSBuildThisFileDirectory)runtime.fx.nuspec + aspnetcore;shared-framework + + true + + + diff --git a/src/Framework/Directory.Build.targets b/src/Framework/Directory.Build.targets new file mode 100644 index 0000000000..1ff9f7da4b --- /dev/null +++ b/src/Framework/Directory.Build.targets @@ -0,0 +1,39 @@ + + + + + + + + + id=$(PackageId); + version=$(PackageVersion); + authors=$(Authors); + rid=$(SharedFxRid); + description=$(PackageDescription); + tags=$(PackageTags.Replace(';', ' ')); + licenseUrl=$(PackageLicenseUrl); + projectUrl=$(PackageProjectUrl); + iconUrl=$(PackageIconUrl); + repositoryUrl=$(RepositoryUrl); + repositoryCommit=$(RepositoryCommit); + copyright=$(Copyright); + targetFramework=$(TargetFramework); + symbolsAssets=$([MSBuild]::NormalizeDirectory($(SymbolsOutputPath))); + nativeAssets=$([MSBuild]::NormalizeDirectory($(NativeAssetsOutputPath))); + runtimeAssets=$([MSBuild]::NormalizeDirectory($(RuntimeAssetsOutputPath))); + + + + + + + + NuGetPackage + $(PackageId) + $(PackageVersion) + + + + + diff --git a/test/SharedFx.UnitTests/AssertEx.cs b/src/Framework/Framework.UnitTests/AssertEx.cs similarity index 100% rename from test/SharedFx.UnitTests/AssertEx.cs rename to src/Framework/Framework.UnitTests/AssertEx.cs diff --git a/test/SharedFx.UnitTests/SharedFx.UnitTests.csproj b/src/Framework/Framework.UnitTests/Framework.UnitTests.csproj similarity index 62% rename from test/SharedFx.UnitTests/SharedFx.UnitTests.csproj rename to src/Framework/Framework.UnitTests/Framework.UnitTests.csproj index bb58bee45a..e1cb8ce5c9 100644 --- a/test/SharedFx.UnitTests/SharedFx.UnitTests.csproj +++ b/src/Framework/Framework.UnitTests/Framework.UnitTests.csproj @@ -3,6 +3,7 @@ netcoreapp3.0 Microsoft.AspNetCore + false @@ -11,12 +12,8 @@ <_Parameter2>$(PackageVersion) - <_Parameter1>DotNetRoot - <_Parameter2>$(SharedFxOutputPath) - - - <_Parameter1>SharedFxRuntimeIdentifier - <_Parameter2>$(SharedFxRuntimeIdentifier) + <_Parameter1>SharedFxRid + <_Parameter2>$(SharedFxRid) <_Parameter1>RepositoryCommit @@ -36,4 +33,20 @@ + + + false + _ResolvedFrameworkReference + + + + + + + <_Parameter1>SharedFxMetadataOutput:%(_ResolvedFrameworkReference.SharedFxName) + <_Parameter2>%(_ResolvedFrameworkReference.MetadataOutputPath) + + + + diff --git a/test/SharedFx.UnitTests/SharedFxTests.cs b/src/Framework/Framework.UnitTests/SharedFxTests.cs similarity index 77% rename from test/SharedFx.UnitTests/SharedFxTests.cs rename to src/Framework/Framework.UnitTests/SharedFxTests.cs index d18fa17ef8..2d255fe35e 100644 --- a/test/SharedFx.UnitTests/SharedFxTests.cs +++ b/src/Framework/Framework.UnitTests/SharedFxTests.cs @@ -13,12 +13,10 @@ namespace Microsoft.AspNetCore [MemberData(nameof(GetSharedFxConfig))] public void ItContainsValidRuntimeConfigFile(SharedFxConfig config) { - var root = TestData.GetDotNetRoot(); - var dir = Path.Combine(root, "shared", config.Name, config.Version); - var runtimeConfigFilePath = Path.Combine(dir, config.Name + ".runtimeconfig.json"); + var runtimeConfigFilePath = Path.Combine(config.MetadataOutput, config.Name + ".runtimeconfig.json"); AssertEx.FileExists(runtimeConfigFilePath); - AssertEx.FileDoesNotExists(Path.Combine(dir, config.Name + ".runtimeconfig.dev.json")); + AssertEx.FileDoesNotExists(Path.Combine(config.MetadataOutput, config.Name + ".runtimeconfig.dev.json")); var runtimeConfig = JObject.Parse(File.ReadAllText(runtimeConfigFilePath)); @@ -32,9 +30,7 @@ namespace Microsoft.AspNetCore [MemberData(nameof(GetSharedFxConfig))] public void ItContainsValidDepsJson(SharedFxConfig config) { - var root = TestData.GetDotNetRoot(); - var dir = Path.Combine(root, "shared", config.Name, config.Version); - var depsFilePath = Path.Combine(dir, config.Name + ".deps.json"); + var depsFilePath = Path.Combine(config.MetadataOutput, config.Name + ".deps.json"); var target = $".NETCoreApp,Version=v{config.Version.Substring(0, 3)}/{config.RuntimeIdentifier}"; @@ -47,14 +43,20 @@ namespace Microsoft.AspNetCore Assert.NotNull(depsFile["compilationOptions"]); Assert.Empty(depsFile["compilationOptions"]); Assert.NotEmpty(depsFile["runtimes"][config.RuntimeIdentifier]); + Assert.All(depsFile["libraries"], item => + { + var prop = Assert.IsType(item); + var lib = Assert.IsType(prop.Value); + Assert.Equal("package", lib["type"].Value()); + Assert.StartsWith("sha512-", lib["sha512"].Value()); + }); } [Theory] [MemberData(nameof(GetSharedFxConfig))] public void ItContainsVersionFile(SharedFxConfig config) { - var root = TestData.GetDotNetRoot(); - var versionFile = Path.Combine(root, "shared", config.Name, config.Version, ".version"); + var versionFile = Path.Combine(config.MetadataOutput, ".version"); AssertEx.FileExists(versionFile); var lines = File.ReadAllLines(versionFile); Assert.Equal(2, lines.Length); @@ -62,7 +64,6 @@ namespace Microsoft.AspNetCore Assert.Equal(config.Version, lines[1]); } - public static TheoryData GetSharedFxConfig() => new TheoryData { @@ -74,6 +75,7 @@ namespace Microsoft.AspNetCore BaseSharedFxVersion = TestData.GetPackageVersion(), BaseSharedFxName = "Microsoft.AspNetCore.App", RuntimeIdentifier = TestData.GetSharedFxRuntimeIdentifier(), + MetadataOutput = TestData.GetTestDataValue("SharedFxMetadataOutput:Microsoft.AspNetCore.All") }, new SharedFxConfig { @@ -82,6 +84,7 @@ namespace Microsoft.AspNetCore BaseSharedFxName = "Microsoft.NETCore.App", BaseSharedFxVersion = TestData.GetMicrosoftNETCoreAppPackageVersion(), RuntimeIdentifier = TestData.GetSharedFxRuntimeIdentifier(), + MetadataOutput = TestData.GetTestDataValue("SharedFxMetadataOutput:Microsoft.AspNetCore.App") }, }; @@ -92,6 +95,7 @@ namespace Microsoft.AspNetCore public string BaseSharedFxName { get; set; } public string BaseSharedFxVersion { get; set; } public string RuntimeIdentifier { get; set; } + public string MetadataOutput { get; set; } } } } diff --git a/test/SharedFx.UnitTests/TestData.cs b/src/Framework/Framework.UnitTests/TestData.cs similarity index 80% rename from test/SharedFx.UnitTests/TestData.cs rename to src/Framework/Framework.UnitTests/TestData.cs index eb01f60e8b..a33613aff8 100644 --- a/test/SharedFx.UnitTests/TestData.cs +++ b/src/Framework/Framework.UnitTests/TestData.cs @@ -12,13 +12,11 @@ namespace Microsoft.AspNetCore public static string GetMicrosoftNETCoreAppPackageVersion() => GetTestDataValue("MicrosoftNETCoreAppPackageVersion"); - public static string GetDotNetRoot() => GetTestDataValue("DotNetRoot"); - public static string GetRepositoryCommit() => GetTestDataValue("RepositoryCommit"); - public static string GetSharedFxRuntimeIdentifier() => GetTestDataValue("SharedFxRuntimeIdentifier"); + public static string GetSharedFxRuntimeIdentifier() => GetTestDataValue("SharedFxRid"); - private static string GetTestDataValue(string key) + public static string GetTestDataValue(string key) => typeof(TestData).Assembly.GetCustomAttributes().Single(d => d.Key == key).Value; } } diff --git a/test/SharedFx.UnitTests/TestDataAttribute.cs b/src/Framework/Framework.UnitTests/TestDataAttribute.cs similarity index 100% rename from test/SharedFx.UnitTests/TestDataAttribute.cs rename to src/Framework/Framework.UnitTests/TestDataAttribute.cs diff --git a/src/Framework/Metapackage.targets b/src/Framework/Metapackage.targets new file mode 100644 index 0000000000..4fc5124a33 --- /dev/null +++ b/src/Framework/Metapackage.targets @@ -0,0 +1,49 @@ + + + + false + + false + + false + + true + + true + + $(MSBuildProjectName) + $(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg + + + + + + + + + $(PackageId) + + + + + + + + + + + + + + None + + + + + + + + diff --git a/src/Framework/Microsoft.AspNetCore.All/pkg/Microsoft.AspNetCore.All.pkgproj b/src/Framework/Microsoft.AspNetCore.All/pkg/Microsoft.AspNetCore.All.pkgproj new file mode 100644 index 0000000000..7f4153e2b6 --- /dev/null +++ b/src/Framework/Microsoft.AspNetCore.All/pkg/Microsoft.AspNetCore.All.pkgproj @@ -0,0 +1,44 @@ + + + + netcoreapp2.2 + aspnetcore + Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. + +This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download. + + + + + + + + + + + + Minimum + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Packages/Microsoft.AspNetCore.All/build/netcoreapp3.0/Microsoft.AspNetCore.All.props b/src/Framework/Microsoft.AspNetCore.All/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.All.props similarity index 100% rename from src/Packages/Microsoft.AspNetCore.All/build/netcoreapp3.0/Microsoft.AspNetCore.All.props rename to src/Framework/Microsoft.AspNetCore.All/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.All.props diff --git a/src/Packages/Microsoft.AspNetCore.All/build/netcoreapp3.0/Microsoft.AspNetCore.All.targets b/src/Framework/Microsoft.AspNetCore.All/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.All.targets similarity index 81% rename from src/Packages/Microsoft.AspNetCore.All/build/netcoreapp3.0/Microsoft.AspNetCore.All.targets rename to src/Framework/Microsoft.AspNetCore.All/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.All.targets index c4f1f46390..ff8736382c 100644 --- a/src/Packages/Microsoft.AspNetCore.All/build/netcoreapp3.0/Microsoft.AspNetCore.All.targets +++ b/src/Framework/Microsoft.AspNetCore.All/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.All.targets @@ -12,7 +12,7 @@ + Text="This version of Microsoft.AspNetCore.All is only compatible with the netcoreapp2.2 target framework. Please target netcoreapp2.2 or choose a version of Microsoft.AspNetCore.All compatible with $(TargetFramework)." + Condition="'$(TargetFramework)' != 'netcoreapp2.2'"/> diff --git a/src/Framework/Microsoft.AspNetCore.All/pkg/lib/netcoreapp2.2/_._ b/src/Framework/Microsoft.AspNetCore.All/pkg/lib/netcoreapp2.2/_._ new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Framework/Microsoft.AspNetCore.All/src/Microsoft.AspNetCore.All.shfxproj b/src/Framework/Microsoft.AspNetCore.All/src/Microsoft.AspNetCore.All.shfxproj new file mode 100644 index 0000000000..63dfa9f68a --- /dev/null +++ b/src/Framework/Microsoft.AspNetCore.All/src/Microsoft.AspNetCore.All.shfxproj @@ -0,0 +1,21 @@ + + + + netcoreapp2.2 + Microsoft.AspNetCore.App + $(MicrosoftNETCoreAppPackageVersion) + + + runtime.$(SharedFxRid).$(MSBuildProjectName) + This package provides assets used for self-contained deployments of an ASP.NET Core application. It is an internal implementation package not meant for direct consumption. Please do not reference directly. + +$(MSBuildProjectName) provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. + + + + + + + + + diff --git a/src/Framework/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.props b/src/Framework/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.props new file mode 100644 index 0000000000..d0dd452557 --- /dev/null +++ b/src/Framework/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.props @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Packages/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.csproj b/src/Framework/Microsoft.AspNetCore.App/pkg/Microsoft.AspNetCore.App.pkgproj similarity index 79% rename from src/Packages/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.csproj rename to src/Framework/Microsoft.AspNetCore.App/pkg/Microsoft.AspNetCore.App.pkgproj index 696eb182db..acde456b6c 100644 --- a/src/Packages/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.csproj +++ b/src/Framework/Microsoft.AspNetCore.App/pkg/Microsoft.AspNetCore.App.pkgproj @@ -1,11 +1,8 @@ - false - false netcoreapp3.0 aspnetcore - false Provides a default set of APIs for building an ASP.NET Core application. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download. @@ -18,4 +15,12 @@ This package requires the ASP.NET Core runtime. This runtime is installed by the + + + MajorMinor + + + + + diff --git a/src/Packages/Microsoft.AspNetCore.App/build/netcoreapp3.0/Microsoft.AspNetCore.App.props b/src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.App.props similarity index 100% rename from src/Packages/Microsoft.AspNetCore.App/build/netcoreapp3.0/Microsoft.AspNetCore.App.props rename to src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.App.props diff --git a/src/Packages/Microsoft.AspNetCore.App/build/netcoreapp3.0/Microsoft.AspNetCore.App.targets b/src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.App.targets similarity index 81% rename from src/Packages/Microsoft.AspNetCore.App/build/netcoreapp3.0/Microsoft.AspNetCore.App.targets rename to src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.App.targets index 2e222008cc..2ba815e5da 100644 --- a/src/Packages/Microsoft.AspNetCore.App/build/netcoreapp3.0/Microsoft.AspNetCore.App.targets +++ b/src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp2.2/Microsoft.AspNetCore.App.targets @@ -12,7 +12,7 @@ + Text="This version of Microsoft.AspNetCore.App is only compatible with the netcoreapp2.2 target framework. Please target netcoreapp2.2 or choose a version of Microsoft.AspNetCore.App compatible with $(TargetFramework)." + Condition="'$(TargetFramework)' != 'netcoreapp2.2'"/> diff --git a/src/Framework/Microsoft.AspNetCore.App/pkg/lib/netcoreapp2.2/_._ b/src/Framework/Microsoft.AspNetCore.App/pkg/lib/netcoreapp2.2/_._ new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Framework/Microsoft.AspNetCore.App/src/Microsoft.AspNetCore.App.shfxproj b/src/Framework/Microsoft.AspNetCore.App/src/Microsoft.AspNetCore.App.shfxproj new file mode 100644 index 0000000000..f0e2af18d9 --- /dev/null +++ b/src/Framework/Microsoft.AspNetCore.App/src/Microsoft.AspNetCore.App.shfxproj @@ -0,0 +1,20 @@ + + + + netcoreapp2.2 + Microsoft.NETCore.App + $(MicrosoftNETCoreAppPackageVersion) + + + runtime.$(SharedFxRid).$(MSBuildProjectName) + This package provides assets used for self-contained deployments of an ASP.NET Core application. It is an internal implementation package not meant for direct consumption. Please do not reference directly. + +$(MSBuildProjectName) provides a default set of APIs for building an ASP.NET Core application. + + + + + + + + diff --git a/src/Framework/_._ b/src/Framework/_._ new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Framework/runtime.fx.nuspec b/src/Framework/runtime.fx.nuspec new file mode 100644 index 0000000000..292d128d1b --- /dev/null +++ b/src/Framework/runtime.fx.nuspec @@ -0,0 +1,24 @@ + + + + $id$ + $version$ + $authors$ + $licenseUrl$ + $projectUrl$ + $iconUrl$ + $description$ + $copyright$ + $tags$ + + true + true + + + + + + + + + diff --git a/src/Installers/Archive.Internal/Archive.Internal.zipproj b/src/Installers/Archive.Internal/Archive.Internal.zipproj new file mode 100644 index 0000000000..2501b67be8 --- /dev/null +++ b/src/Installers/Archive.Internal/Archive.Internal.zipproj @@ -0,0 +1,49 @@ + + + + + + + + $(RepositoryRoot)obj\ai\$(SharedFxRid)\ + $(InternalInstallerBaseName)-$(PackageVersion)-$(SharedFxRid)$(ArchiveExtension) + $(InstallersOutputPath) + $(InstallersOutputPath)$(OutputFileName) + + + + + true + _ResolvedFxProjects + + + + + + + + + + + + + + $(IntermediateOutputPath)shared\%(SharedFxAssetFolder.SharedFxName)\$(PackageVersion)\ + + + + + + + + + + diff --git a/src/Installers/Archive.Redist/Archive.Redist.zipproj b/src/Installers/Archive.Redist/Archive.Redist.zipproj new file mode 100644 index 0000000000..b667e2634c --- /dev/null +++ b/src/Installers/Archive.Redist/Archive.Redist.zipproj @@ -0,0 +1,68 @@ + + + + + + + + $(RepositoryRoot)obj\ar\ + $(BaseIntermediateOutputPath)$(SharedFxRid)\ + $(RuntimeInstallerBaseName)-$(PackageVersion)-$(SharedFxRid)$(ArchiveExtension) + $(InstallersOutputPath) + $(InstallersOutputPath)$(OutputFileName) + dotnet-runtime-$(MicrosoftNETCoreAppPackageVersion)-$(SharedFxRid)$(ArchiveExtension) + $(DotNetAssetRootUrl)Runtime/$(MicrosoftNETCoreAppPackageVersion)/$(DotNetRuntimeArchiveFileName) + $(BaseIntermediateOutputPath)$(DotNetRuntimeArchiveFileName) + + + + + true + _ResolvedFxProjects + + + + + + + + + + + + + + + + $(IntermediateOutputPath)shared\%(SharedFxAssetFolder.SharedFxName)\$(PackageVersion)\ + + + + + + + + + + + + + + + + + diff --git a/src/Installers/Directory.Build.props b/src/Installers/Directory.Build.props new file mode 100644 index 0000000000..489a37b2c8 --- /dev/null +++ b/src/Installers/Directory.Build.props @@ -0,0 +1,14 @@ + + + + + + aspnetcore-runtime + + $(RuntimeInstallerBaseName)-internal + + .tar.gz + .zip + + + diff --git a/src/Installers/Windows/Directory.Build.props b/src/Installers/Windows/Directory.Build.props index 096863e245..af15a651bd 100644 --- a/src/Installers/Windows/Directory.Build.props +++ b/src/Installers/Windows/Directory.Build.props @@ -8,10 +8,6 @@ $(RootOutputPath)obj/$(MSBuildProjectName)/ $(BaseIntermediateOutputPath)$(Configuration)/ $(IntermediateOutputPath)$(Platform)/ - - aspnetcore-runtime - - $(RuntimeInstallerBaseName)-internal diff --git a/src/Installers/Windows/SharedFrameworkLib/SharedFrameworkLib.wixproj b/src/Installers/Windows/SharedFrameworkLib/SharedFrameworkLib.wixproj index 672ca7de66..40fd51c943 100644 --- a/src/Installers/Windows/SharedFrameworkLib/SharedFrameworkLib.wixproj +++ b/src/Installers/Windows/SharedFrameworkLib/SharedFrameworkLib.wixproj @@ -4,7 +4,8 @@ AspNetCoreSharedFrameworkLib$(Platform) - $(WixlibBaseFileName)-$(PackageVersion)-win-$(Platform) + + $(InternalInstallerBaseName)-$(PackageVersion)-win-$(Platform) Library true $(SharedFrameworkNamespaceGuid) diff --git a/src/Packages/Directory.Build.props b/src/Packages/Directory.Build.props deleted file mode 100644 index 02d2ee4d23..0000000000 --- a/src/Packages/Directory.Build.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Packages/Directory.Build.targets b/src/Packages/Directory.Build.targets deleted file mode 100644 index db9b73869a..0000000000 --- a/src/Packages/Directory.Build.targets +++ /dev/null @@ -1,11 +0,0 @@ - - - - - NuGetPackage - $(PackageId) - $(PackageVersion) - - - - diff --git a/src/Packages/Microsoft.AspNetCore.All/Microsoft.AspNetCore.All.csproj b/src/Packages/Microsoft.AspNetCore.All/Microsoft.AspNetCore.All.csproj deleted file mode 100644 index d53330052a..0000000000 --- a/src/Packages/Microsoft.AspNetCore.All/Microsoft.AspNetCore.All.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - false - false - netcoreapp3.0 - aspnetcore - false - Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. - -This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download. - - - - - - - - - - diff --git a/src/Packages/Microsoft.AspNetCore.Analyzers/Microsoft.AspNetCore.Analyzers.csproj b/src/Packages/Microsoft.AspNetCore.Analyzers/Microsoft.AspNetCore.Analyzers.csproj deleted file mode 100644 index a9f9071719..0000000000 --- a/src/Packages/Microsoft.AspNetCore.Analyzers/Microsoft.AspNetCore.Analyzers.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - false - false - netstandard2.0 - aspnetcore - Microsoft.AspNetCore.Analyzers - - $(ExperimentalVersionPrefix) - $(ExperimentalVersionSuffix) - $(ExperimentalPackageVersion) - false - - false - - - diff --git a/src/SiteExtensions/SiteExtensions.sln b/src/SiteExtensions/SiteExtensions.sln index 8fe1d6c64c..39b0b63e47 100644 --- a/src/SiteExtensions/SiteExtensions.sln +++ b/src/SiteExtensions/SiteExtensions.sln @@ -5,9 +5,13 @@ VisualStudioVersion = 15.0.26124.0 MinimumVisualStudioVersion = 15.0.26124.0 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0ED05384-4F64-44BA-A4AA-47519DA26E8C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.AzureAppServices.SiteExtension", "src\Microsoft.AspNetCore.AzureAppServices.SiteExtension\Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj", "{69E22952-302D-4C56-B2BE-7C086EB05C79}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServices.SiteExtension", "src\Microsoft.AspNetCore.AzureAppServices.SiteExtension\Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj", "{69E22952-302D-4C56-B2BE-7C086EB05C79}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Web.Xdt.Extensions", "src\Microsoft.Web.Xdt.Extensions\Microsoft.Web.Xdt.Extensions.csproj", "{637E1D65-7F1C-476B-AD0A-30B295DF5414}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Web.Xdt.Extensions", "src\Microsoft.Web.Xdt.Extensions\Microsoft.Web.Xdt.Extensions.csproj", "{637E1D65-7F1C-476B-AD0A-30B295DF5414}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{6C71D9CD-271C-41CB-ACCD-9EABED6C9E80}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests", "test\Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests\Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests.csproj", "{A0798DB8-7681-4F00-94EC-CC966F4F3CD0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -18,9 +22,6 @@ Global Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {69E22952-302D-4C56-B2BE-7C086EB05C79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {69E22952-302D-4C56-B2BE-7C086EB05C79}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -46,9 +47,28 @@ Global {637E1D65-7F1C-476B-AD0A-30B295DF5414}.Release|x64.Build.0 = Release|Any CPU {637E1D65-7F1C-476B-AD0A-30B295DF5414}.Release|x86.ActiveCfg = Release|Any CPU {637E1D65-7F1C-476B-AD0A-30B295DF5414}.Release|x86.Build.0 = Release|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Debug|x64.ActiveCfg = Debug|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Debug|x64.Build.0 = Debug|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Debug|x86.ActiveCfg = Debug|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Debug|x86.Build.0 = Debug|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Release|Any CPU.Build.0 = Release|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Release|x64.ActiveCfg = Release|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Release|x64.Build.0 = Release|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Release|x86.ActiveCfg = Release|Any CPU + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {69E22952-302D-4C56-B2BE-7C086EB05C79} = {0ED05384-4F64-44BA-A4AA-47519DA26E8C} {637E1D65-7F1C-476B-AD0A-30B295DF5414} = {0ED05384-4F64-44BA-A4AA-47519DA26E8C} + {A0798DB8-7681-4F00-94EC-CC966F4F3CD0} = {6C71D9CD-271C-41CB-ACCD-9EABED6C9E80} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7ACE43EF-2C19-4D80-B7DB-0169D9302623} EndGlobalSection EndGlobal diff --git a/src/SiteExtensions/build/dependencies.props b/src/SiteExtensions/build/dependencies.props index 4a707b5182..e20e907408 100644 --- a/src/SiteExtensions/build/dependencies.props +++ b/src/SiteExtensions/build/dependencies.props @@ -7,7 +7,10 @@ 2.2.0-preview2-20181004.6 2.1.1-rtm-31076 2.2.0-rtm-35515 + 15.6.1 1.4.0 + 2.4.0 + 2.4.0 diff --git a/src/SiteExtensions/global.json b/src/SiteExtensions/global.json index ee1ec7cbce..bf91e8bc39 100644 --- a/src/SiteExtensions/global.json +++ b/src/SiteExtensions/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "2.2.100-preview2-009404" + "version": "2.2.100-preview3-009430" }, "msbuild-sdks": { "Internal.AspNetCore.Sdk": "3.0.0-alpha1-20181018.6" diff --git a/src/SiteExtensions/test/Directory.Build.props b/src/SiteExtensions/test/Directory.Build.props new file mode 100644 index 0000000000..4e09287e4d --- /dev/null +++ b/src/SiteExtensions/test/Directory.Build.props @@ -0,0 +1,18 @@ + + + + + netcoreapp2.2 + $(DeveloperBuildTestTfms) + + $(StandardTestTfms);net461 + + + + + + + + + + diff --git a/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests.csproj b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests.csproj new file mode 100644 index 0000000000..9928aadbcc --- /dev/null +++ b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests.csproj @@ -0,0 +1,29 @@ + + + + net461 + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + + + diff --git a/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/TransformTest.cs b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/TransformTest.cs new file mode 100644 index 0000000000..1480483804 --- /dev/null +++ b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/TransformTest.cs @@ -0,0 +1,93 @@ +// 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. + +using System; +using System.IO; +using System.Xml; +using Microsoft.Web.XmlTransform; +using Xunit; + +namespace Microsoft.AspNetCore.AzureAppServices.SiteExtension +{ + public class TransformTest + { + private static readonly string XdtExtensionPath = AppDomain.CurrentDomain.BaseDirectory; + + [Theory] + [InlineData("config_empty.xml")] + [InlineData("config_existingline.xml")] + [InlineData("config_existingEmptyValue.xml")] + public void Transform_EmptyConfig_Added(string configFile) + { + var doc = LoadDocAndRunTransform(configFile); + + Assert.Equal(2, doc.ChildNodes.Count); + var envNode = doc["configuration"]?["system.webServer"]?["runtime"]?["environmentVariables"]; + + Assert.NotNull(envNode); + + Assert.Equal(3, envNode.ChildNodes.Count); + + var depsElement = envNode.FirstChild; + Assert.Equal("add", depsElement.Name); + Assert.Equal("DOTNET_ADDITIONAL_DEPS", depsElement.Attributes["name"].Value); + Assert.Equal($@"{XdtExtensionPath}\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\;" + + @"%ProgramFiles%\dotnet\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\", + depsElement.Attributes["value"].Value); + + var sharedStoreElement = depsElement.NextSibling; + Assert.Equal("add", sharedStoreElement.Name); + Assert.Equal("DOTNET_SHARED_STORE", sharedStoreElement.Attributes["name"].Value); + Assert.Equal($@"{XdtExtensionPath}\store", sharedStoreElement.Attributes["value"].Value); + + var startupAssembliesElement = sharedStoreElement.NextSibling; + Assert.Equal("add", startupAssembliesElement.Name); + Assert.Equal("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES", startupAssembliesElement.Attributes["name"].Value); + Assert.Equal("Microsoft.AspNetCore.AzureAppServices.HostingStartup", startupAssembliesElement.Attributes["value"].Value); + } + + [Fact] + public void Transform_ExistingValue_AppendsValue() + { + var doc = LoadDocAndRunTransform("config_existingvalue.xml"); + + Assert.Equal(2, doc.ChildNodes.Count); + var envNode = doc["configuration"]?["system.webServer"]?["runtime"]?["environmentVariables"]; + + Assert.NotNull(envNode); + + Assert.Equal(3, envNode.ChildNodes.Count); + + var depsElement = envNode.FirstChild; + Assert.Equal("add", depsElement.Name); + Assert.Equal("DOTNET_ADDITIONAL_DEPS", depsElement.Attributes["name"].Value); + Assert.Equal(@"ExistingValue1;"+ + $@"{XdtExtensionPath}\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\;" + + @"%ProgramFiles%\dotnet\additionalDeps\Microsoft.AspNetCore.AzureAppServices.HostingStartup\", + depsElement.Attributes["value"].Value); + + var sharedStoreElement = depsElement.NextSibling; + Assert.Equal("add", sharedStoreElement.Name); + Assert.Equal("DOTNET_SHARED_STORE", sharedStoreElement.Attributes["name"].Value); + Assert.Equal($@"ExistingValue3;{XdtExtensionPath}\store", sharedStoreElement.Attributes["value"].Value); + + var startupAssembliesElement = sharedStoreElement.NextSibling; + Assert.Equal("add", startupAssembliesElement.Name); + Assert.Equal("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES", startupAssembliesElement.Attributes["name"].Value); + Assert.Equal("ExistingValue2;Microsoft.AspNetCore.AzureAppServices.HostingStartup", startupAssembliesElement.Attributes["value"].Value); + } + + private static XmlDocument LoadDocAndRunTransform(string docName) + { + // Microsoft.Web.Hosting.Transformers.ApplicationHost.SiteExtensionDefinition.Transform + // (See Microsoft.Web.Hosting, Version=7.1.0.0) replaces variables for you in Azure. + var transformFile = File.ReadAllText("applicationHost.xdt"); + transformFile = transformFile.Replace("%XDT_EXTENSIONPATH%", XdtExtensionPath); + var transform = new XmlTransformation(transformFile, isTransformAFile: false, logger: null); + var doc = new XmlDocument(); + doc.Load(docName); + Assert.True(transform.Apply(doc)); + return doc; + } + } +} diff --git a/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_empty.xml b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_empty.xml new file mode 100644 index 0000000000..1156926c52 --- /dev/null +++ b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_empty.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingemptyvalue.xml b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingemptyvalue.xml new file mode 100644 index 0000000000..b25079c3ce --- /dev/null +++ b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingemptyvalue.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingline.xml b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingline.xml new file mode 100644 index 0000000000..312e525b86 --- /dev/null +++ b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingline.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingvalue.xml b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingvalue.xml new file mode 100644 index 0000000000..4659b9a48b --- /dev/null +++ b/src/SiteExtensions/test/Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests/config_existingvalue.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Cli.FunctionalTests/Templates/WebTemplate.cs b/test/Cli.FunctionalTests/Templates/WebTemplate.cs index ea584efb3c..783b02eddb 100644 --- a/test/Cli.FunctionalTests/Templates/WebTemplate.cs +++ b/test/Cli.FunctionalTests/Templates/WebTemplate.cs @@ -190,6 +190,7 @@ namespace Cli.FunctionalTests.Templates "Microsoft.Extensions.Options.dll", "Microsoft.Extensions.Primitives.dll", "Microsoft.Extensions.WebEncoders.dll", + "Microsoft.IdentityModel.JsonWebTokens.dll", "Microsoft.IdentityModel.Logging.dll", "Microsoft.IdentityModel.Protocols.dll", "Microsoft.IdentityModel.Protocols.OpenIdConnect.dll", diff --git a/version.props b/version.props index 96b67d47f8..4e955995c4 100644 --- a/version.props +++ b/version.props @@ -5,7 +5,7 @@ 0 alpha1 Alpha 1 - t000 + $([System.DateTime]::Now.ToString('yyMMdd'))-99 $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion) 0.3.$(AspNetCorePatchVersion) $(PreReleaseLabel)-$(BuildNumber)