--- /dev/null
+<Project>
+ <!--
+ Shared properties specific to shared framework projects (sfxproj).
+ -->
+
+ <PropertyGroup>
+ <TargetFramework>$(NETCoreAppFramework)</TargetFramework>
+ <PackageId>unused</PackageId>
+
+ <ProjectDepsFileName>$(SharedFrameworkName).deps.json</ProjectDepsFileName>
+
+ <!--
+ When blank, MicrosoftNETPlatformLibrary defaults to Microsoft.NETCore.App. This property
+ causes the SDK to trim dependencies when publishing a framework-dependent app. We want to be
+ able to create Microsoft.NETCore.App here, so disable this behavior. Use a non-'' value to
+ avoid the default and make it hint at the goal in case it shows up in a weird place.
+ -->
+ <MicrosoftNETPlatformLibrary>do-not-consider-existing-platform</MicrosoftNETPlatformLibrary>
+
+ <!-- Only Restore from our built packages -->
+ <RestoreSources>$(ArtifactsShippingPackagesDir)</RestoreSources>
+ <AddDotnetfeedProjectSource>false</AddDotnetfeedProjectSource>
+ <RestoreAllBuildRids>false</RestoreAllBuildRids>
+ <!-- Ensure only this repo's NuGet.config file is used. -->
+ <RestoreConfigFile>$(ProjectDir)NuGet.config</RestoreConfigFile>
+ <!-- Use repo-restored packages for platforms and targets dependencies -->
+ <RestoreFallbackFolders>$(PackagesDir)</RestoreFallbackFolders>
+ <!-- Don't error due to lack of runtime-specific deps, we're referencing those directly -->
+ <EnsureRuntimePackageDependencies>false</EnsureRuntimePackageDependencies>
+ <!-- Use a project-local packages folder. 'p', not 'packages': max path breathing room. -->
+ <RestorePackagesPath>$(IntermediateOutputPath)p</RestorePackagesPath>
+ <!-- Do not build or nor build in publish output or deps -->
+ <NoBuild>true</NoBuild>
+
+ <CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
+ <CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
+ <IncludeMainProjectInDepsFile>false</IncludeMainProjectInDepsFile>
+
+ <GenerateSharedFramework>true</GenerateSharedFramework>
+ </PropertyGroup>
+
+</Project>
-<Project Sdk="Microsoft.NET.Sdk" InitialTargets="GetPackageReference" DefaultTargets="Restore;Publish">
+<Project>
<!--
- This project lays out a shared framework using the SDK targets.
+ Shared targets specific to shared framework projects (sfxproj).
-->
- <UsingTask TaskName="ProcessSharedFrameworkDeps" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll" />
+ <UsingTask TaskName="ProcessSharedFrameworkDeps" AssemblyFile="$(LocalBuildToolsTaskFile)" />
- <PropertyGroup>
- <TargetFramework>$(NETCoreAppFramework)</TargetFramework>
- <RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier>
- <PackageId>unused</PackageId>
-
- <ProjectDepsFileName>$(SharedFrameworkName).deps.json</ProjectDepsFileName>
+ <Target Name="GetPackageReference"
+ DependsOnTargets="GetProductVersions"
+ BeforeTargets="CollectPackageReferences">
+ <PropertyGroup>
+ <SfxVersion Condition="'$(SfxVersion)' == ''">$(ProductVersion)</SfxVersion>
+ <SfxPackageIdentity Condition="'$(SfxPackageIdentity)' == ''">$(SfxIdentity)</SfxPackageIdentity>
+ </PropertyGroup>
<!--
- When blank, MicrosoftNETPlatformLibrary defaults to Microsoft.NETCore.App. This property
- causes the SDK to trim dependencies when publishing a framework-dependent app. We want to be
- able to create Microsoft.NETCore.App here, so disable this behavior. Use a non-'' value to
- avoid the default and make it hint at the goal in case it shows up in a weird place.
+ Get rid of NuGet's ExcludeRestorePackageImports=true so that the packaging tooling is
+ accessible for Id and version.
-->
- <MicrosoftNETPlatformLibrary>do-not-consider-existing-platform</MicrosoftNETPlatformLibrary>
-
- <!-- Don't reference NETCore.App -->
- <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
- <!-- Only Restore from our built packages -->
- <RestoreSources>$(PackageOutputPath)</RestoreSources>
- <!-- Ensure only this repo's NuGet.config file is used. -->
- <RestoreConfigFile>$(ProjectDir)NuGet.config</RestoreConfigFile>
- <!-- Use repo-restored packages for platforms and targets dependencies -->
- <RestoreFallbackFolders>$(PackagesDir)</RestoreFallbackFolders>
- <DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
- <!-- Don't error due to lack of runtime-specific deps, we're referencing those directly -->
- <EnsureRuntimePackageDependencies>false</EnsureRuntimePackageDependencies>
- <!-- Use a project-local packages folder. 'p', not 'packages': max path breathing room. -->
- <RestorePackagesPath>$(IntermediateOutputPath)p</RestorePackagesPath>
- <!-- Do not build or nor build in publish output or deps -->
- <NoBuild>true</NoBuild>
- <CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
- <CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
- <IncludeMainProjectInDepsFile>false</IncludeMainProjectInDepsFile>
- </PropertyGroup>
-
- <Target Name="GetPackageReference">
- <Error Condition="'$(SharedFrameworkName)' == ''" Text="'SharedFrameworkName' property not specified." />
- <Error Condition="'$(SharedFrameworkPkgprojFile)' == ''" Text="'SharedFrameworkPkgprojFile' property not specified." />
-
<MSBuild
- Projects="$(SharedFrameworkPkgprojFile)"
+ Projects="@(PkgProjectReference)"
Targets="GetPackageIdentity"
- RemoveProperties="Configuration">
- <Output TaskParameter="TargetOutputs" ItemName="SfxIdentity" />
+ Properties="ExcludeRestorePackageImports=false">
+ <Output TaskParameter="TargetOutputs" ItemName="FrameworkPackageReference" />
</MSBuild>
- <PropertyGroup>
- <SfxIdentity>%(SfxIdentity.Identity)</SfxIdentity>
- <SfxVersion>%(SfxIdentity.Version)</SfxVersion>
- <PublishDir>$(SharedFrameworkLayoutDir)shared/$(SfxIdentity)/$(SfxVersion)/</PublishDir>
- </PropertyGroup>
-
- <MSBuild
- Projects="$(SharedFrameworkPkgprojFile)"
- Targets="GetSharedFrameworkPackageReferences"
- RemoveProperties="Configuration">
- <Output TaskParameter="TargetOutputs" ItemName="PackageReference" />
- </MSBuild>
+ <ItemGroup>
+ <PackageReference Include="@(FrameworkPackageReference)" AllowExplicitVersion="true" />
+ </ItemGroup>
</Target>
<!--
</PropertyGroup>
<WriteLinesToFile
- File="$(PublishDir)$(SharedFrameworkName).runtimeconfig.json"
+ File="$(PublishDir)$(MSBuildProjectName).runtimeconfig.json"
Lines="$(_runtimeConfigContent)"
Overwrite="true" />
</Target>
<!-- Generate .version file -->
<ItemGroup>
<VersionLines Include="$(LatestCommit)" />
- <VersionLines Include="%(PackageReference.Version)" />
+ <VersionLines Include="$(SfxVersion)" />
</ItemGroup>
<WriteLinesToFile
Condition="'$(GenerateRuntimeGraph)' == 'true'"
AfterTargets="Publish">
<PropertyGroup>
- <SharedFrameworkAssetsFile>$(IntermediateOutputPath)/project.assets.json</SharedFrameworkAssetsFile>
<SharedFrameworkDepsFile>$(PublishDir)$(ProjectDepsFileName)</SharedFrameworkDepsFile>
<RuntimeGraphGeneratorRuntime Condition="'$(OSGroup)'=='Windows_NT'">win</RuntimeGraphGeneratorRuntime>
<RuntimeGraphGeneratorRuntime Condition="'$(OSGroup)'=='OSX'">osx</RuntimeGraphGeneratorRuntime>
<TrimPkgsFromDeps Include="microsoft.netcore.dotnethostresolver" />
</ItemGroup>
- <ProcessSharedFrameworkDeps AssetsFilePath="$(SharedFrameworkAssetsFile)"
+ <ProcessSharedFrameworkDeps AssetsFilePath="$(ProjectAssetsFile)"
DepsFilePath="$(SharedFrameworkDepsFile)"
PackagesToRemove="@(TrimPkgsFromDeps)"
Runtime="$(RuntimeGraphGeneratorRuntime)"
- BuildToolsTaskDir="$(BuildToolsTaskDir)" />
+ BuildTasksAssemblyPath="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll" />
</Target>
<Target Name="CleanPackages" BeforeTargets="Clean">
<Delete Files="$(ProjectAssetsFile)" />
</Target>
+ <!--
+ Ensure the pkgproj is already built. This isn't a real ProjectReference because the SDK doesn't
+ seem to handle pkgproj nicely for Publish. For now we're using its nupkg directly.
+ -->
+ <Target Name="BuildPkgProjectReferences">
+ <MSBuild Projects="@(PkgProjectReference)" Targets="Build" />
+ </Target>
+
+ <Target Name="SetPublishDir"
+ DependsOnTargets="GetPackageReference">
+ <PropertyGroup>
+ <PublishDir>$(SharedFrameworkLayoutDir)shared/$(SfxIdentity)/$(SfxVersion)/</PublishDir>
+ </PropertyGroup>
+ </Target>
+
+ <!-- Target overrides -->
+
+ <!--
+ Redefine build. Shared framework generation uses pkgproj packages.
+ -->
+ <Target Name="Build"
+ DependsOnTargets="
+ BuildPkgProjectReferences;
+ SetPublishDir;
+ CleanPackages;
+ Restore;
+ Publish;
+ GenerateInstallers" />
+
</Project>
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <SfxIdentity>Microsoft.NETCore.App</SfxIdentity>
+ <SfxPackageIdentity>$(SfxIdentity).Internal</SfxPackageIdentity>
+
+ <!-- Lay out the sfx in the legacy location for old packaging to keep working for now. -->
+ <SharedFrameworkLayoutDir>$(SharedFrameworkPublishDir)</SharedFrameworkLayoutDir>
+
+ <GenerateRuntimeGraph>true</GenerateRuntimeGraph>
+
+ <!-- These components are installed by the root shared framework, but not others. -->
+ <IncludeWerRelatedKeys>true</IncludeWerRelatedKeys>
+ <IncludeBreadcrumbStoreFolder>true</IncludeBreadcrumbStoreFolder>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PkgProjectReference Include="..\pkg\legacy\Microsoft.NETCore.App.Internal.pkgproj" />
+ <PkgProjectReference Include="..\pkg\legacy\Microsoft.NETCore.App.pkgproj" />
+ <PkgProjectReference Include="..\..\Microsoft.NETCore.DotNetHost\Microsoft.NETCore.DotNetHost.pkgproj" />
+ </ItemGroup>
+
+ <!--
+ Make sure the installer file is generated with the old infra's name and location. This allows
+ the existing infra to bundle it without any changes.
+ -->
+ <Target Name="PutSharedFrameworkMsiInLegacyLocation"
+ DependsOnTargets="GetInstallerLocations"
+ BeforeTargets="GetInstallerProperties">
+ <PropertyGroup>
+ <InstallerFile>$(SharedFrameworkInstallerFile)</InstallerFile>
+ </PropertyGroup>
+ </Target>
+
+</Project>