Skip to content

Commit 412adb3

Browse files
authored
Correctly build VSTemplateLocator package
1 parent 2759bdf commit 412adb3

9 files changed

+1215
-1203
lines changed

Directory.Build.targets

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
33
<Project>
4+
45
<ItemGroup>
56
<SupportedPlatform Remove="Android" />
67
<SupportedPlatform Remove="iOS" />
@@ -36,13 +37,18 @@
3637

3738
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
3839

40+
<PropertyGroup>
41+
<FullNugetVersion>$(VersionPrefix)-$(PreReleaseVersionLabel)</FullNugetVersion>
42+
<FullNugetVersion Condition="'$(PreReleaseVersionIteration)' != ''">$(FullNugetVersion).$(PreReleaseVersionIteration)</FullNugetVersion>
43+
<FullNugetVersion Condition=" '$(VersionSuffixDateStamp)' != '' And '$(VersionSuffixBuildOfTheDay)' != '' ">$(FullNugetVersion).$(VersionSuffixDateStamp).$(VersionSuffixBuildOfTheDay)</FullNugetVersion>
44+
</PropertyGroup>
45+
3946
<!-- Optionally override arcade's test target with one which will run the tests as tools.
4047
Conditionally overriding a target requires a conditional import of another (.targets)
4148
file. -->
4249
<Import Project="OverrideTest.targets"
4350
Condition="'$(RunTestsAsTool)' == 'true' And '$(CanRunTestAsTool)' == 'true'"/>
4451

45-
4652
<!-- Update KnownFrameworkReferences to target the right version of the runtime -->
4753
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'
4854
and $(MicrosoftNETCoreAppRefPackageVersion.StartsWith('$(_TargetFrameworkVersionWithoutV)'))

eng/Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<!-- For product build, build SdkResolver and VSTemplateLocator only in the second build pass as they depend on
1111
assets from other verticals that are built in the first build pass. -->
1212
<ProjectToBuild Include="$(RepoRoot)src\Installer\redist-installer\projects\SdkResolver.csproj" DotNetBuildPass="2" />
13-
<ProjectToBuild Include="$(RepoRoot)src\Installer\redist-installer\projects\VSTemplateLocator.csproj" DotNetBuildPass="2" />
13+
<ProjectToBuild Include="$(RepoRoot)src\Installer\redist-installer\projects\VSTemplateLocator\VSTemplateLocator.csproj" DotNetBuildPass="2" />
1414
</ItemGroup>
1515

1616
</Project>

sdk.sln

Lines changed: 1168 additions & 1168 deletions
Large diffs are not rendered by default.

src/Installer/redist-installer/projects/VSTemplateLocator.csproj renamed to src/Installer/redist-installer/projects/VSTemplateLocator/VSTemplateLocator.csproj

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
<Project Sdk="Microsoft.Build.NoTargets/3.7.0">
1+
<Project Sdk="Microsoft.Build.NoTargets">
22

33
<PropertyGroup>
44
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
55
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
6-
<GenerateDependencyFile>false</GenerateDependencyFile>
76
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
8-
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
7+
8+
<VSTemplateLocatorNuspecFile>$(MSBuildThisFileDirectory)VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.nuspec</VSTemplateLocatorNuspecFile>
9+
<VSTemplateLocatorNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.$(FullNugetVersion).nupkg</VSTemplateLocatorNupkgFile>
10+
911
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
1012
<!-- For product build, this project only builds in the second build pass as it depends on assets other
1113
verticals that are built in the first build pass. -->
@@ -23,11 +25,7 @@
2325
<ProjectReference Include="$(RepoRoot)src\Microsoft.DotNet.TemplateLocator\Microsoft.DotNet.TemplateLocator.csproj" ReferenceOutputAssembly="false" />
2426
</ItemGroup>
2527

26-
<Target Name="GenerateLayout"
27-
Condition="'$(OS)' == 'Windows_NT' and '$(_SuppressAllTargets)' != 'true'"
28-
BeforeTargets="AfterBuild">
29-
<Message Importance="High" Text="$(MSBuildProjectName) -&gt; $(OutputPath)" />
30-
28+
<Target Name="GenerateLayout">
3129
<RemoveDir Directories="$(OutputPath)" />
3230
<MakeDir Directories="$(OutputPath)" />
3331

@@ -43,6 +41,30 @@
4341
</ItemGroup>
4442

4543
<Copy SourceFiles="@(_VSTemplateLocatorSrc)" DestinationFiles="@(_VSTemplateLocatorDst)" />
44+
45+
<Message Importance="High" Text="$(MSBuildProjectName) -&gt; $(OutputPath)" />
46+
</Target>
47+
48+
<!-- For product build, this only builds in the second build pass as it depends on assets
49+
from other verticals that are built in the first build pass. -->
50+
<Target Name="GenerateVSTemplateLocatorNupkg"
51+
DependsOnTargets="GenerateLayout"
52+
Condition="'$(OS)' == 'Windows_NT' and
53+
'$(Architecture)' == 'x64' and
54+
'$(PgoInstrument)' != 'true' and
55+
('$(DotNetBuild)' != 'true' or '$(DotNetBuildPass)' == '2') and
56+
'$(_SuppressAllTargets)' != 'true'"
57+
Inputs="$(OutputPath)/**/*;
58+
$(VSTemplateLocatorNuspecFile);
59+
$(GenerateNupkgPowershellScript)"
60+
Outputs="$(VSTemplateLocatorNupkgFile)"
61+
AfterTargets="Build">
62+
<Exec Command="powershell -NoProfile -NoLogo $(GenerateNupkgPowershellScript) ^
63+
'$(ArtifactsDir)' ^
64+
'$(OutputPath.TrimEnd('\'))' ^
65+
'$(FullNugetVersion)' ^
66+
'$(VSTemplateLocatorNuspecFile)' ^
67+
'$(VSTemplateLocatorNupkgFile)'" />
4668
</Target>
4769

4870
</Project>

src/Installer/redist-installer/redist-installer.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
which need assets from other verticals that are built in the first build pass. -->
2626
<ItemGroup Condition="'$(DotNetBuild)' != 'true' or '$(ExcludeFromDotNetBuild)' != 'true'">
2727
<ProjectReference Include="projects\SdkResolver.csproj" ReferenceOutputAssembly="false" />
28-
<ProjectReference Include="projects\VSTemplateLocator.csproj" ReferenceOutputAssembly="false" />
2928
</ItemGroup>
3029

3130
<ItemGroup>
@@ -35,7 +34,6 @@
3534
<Import Project="targets\BuildCoreSdkTasks.targets" />
3635
<Import Project="targets\GetRuntimeInformation.targets" />
3736
<Import Project="targets\SetBuildDefaults.targets" />
38-
<Import Project="targets\Versions.targets" />
3937
<Import Project="targets\Branding.targets" />
4038
<Import Project="targets\BundledTemplates.targets" />
4139
<Import Project="targets\BundledManifests.targets" />

src/Installer/redist-installer/targets/GenerateLayout.targets

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@
511511
</Target>
512512

513513
<Target Name="GenerateVersionFile"
514-
DependsOnTargets="SetupBundledComponents;GenerateFullNuGetVersion">
514+
DependsOnTargets="SetupBundledComponents">
515515
<WriteLinesToFile File="$(SdkOutputDirectory).version"
516516
Lines="$(SourceRevisionId);$(Version);$(Rid);$(FullNugetVersion);$(SdkFeatureBand)"
517517
Overwrite="true" />
@@ -611,7 +611,6 @@
611611
DependsOnTargets="DownloadBundledComponents;
612612
CleanLayoutPath;
613613
LayoutBundledComponents;
614-
GenerateFullNuGetVersion;
615614
GenerateVersionFile;
616615
CopyKnownWorkloadManifestFile;
617616
GenerateBundledVersions;

src/Installer/redist-installer/targets/GenerateMSIs.targets

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
<SdkMSBuildExtensionsNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.$(FullNugetVersion).nupkg</SdkMSBuildExtensionsNupkgFile>
3434
<SdkMSBuildExtensionsSwrFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.swr</SdkMSBuildExtensionsSwrFile>
3535

36-
<VSTemplateLocatorLayoutPath>$(ArtifactsDir)bin/VSTemplateLocator/$(Configuration)</VSTemplateLocatorLayoutPath>
37-
<VSTemplateLocatorNuspecFile>$(SdkPkgSourcesRootDirectory)/VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.nuspec</VSTemplateLocatorNuspecFile>
38-
<VSTemplateLocatorNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.$(FullNugetVersion).nupkg</VSTemplateLocatorNupkgFile>
39-
4036
<!-- Temp directory for light command layouts -->
4137
<LightCommandObjDir>$(ArtifactsObjDir)/LightCommandPackages</LightCommandObjDir>
4238
<!-- Directory for the zipped up light command package -->
@@ -440,12 +436,14 @@
440436
</ItemGroup>
441437
</Target>
442438

439+
<!-- For product build, this only builds in the second build pass as it depends on assets
440+
from other verticals that are built in the first build pass. -->
443441
<Target Name="GenerateSdkMSBuildExtensionsNupkg"
444442
DependsOnTargets="GenerateLayout;GenerateMSBuildExtensions;MsiTargetsSetupInputOutputs"
445-
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x64' "
443+
Condition="'$(OS)' == 'Windows_NT' and '$(Architecture)' == 'x64' and ('$(DotNetBuild)' != 'true' or '$(DotNetBuildPass)' == '2')"
446444
Inputs="$(MSBuildExtensionsLayoutDirectory)/**/*;
447-
$(SdkMSBuildExtensionsNuspecFile);
448-
$(GenerateNupkgPowershellScript)"
445+
$(SdkMSBuildExtensionsNuspecFile);
446+
$(GenerateNupkgPowershellScript)"
449447
Outputs="$(SdkMSBuildExtensionsNupkgFile);$(SdkMSBuildExtensionsSwrFile)">
450448
<GenerateMSBuildExtensionsSWR MSBuildExtensionsLayoutDirectory="$(MSBuildExtensionsLayoutDirectory)"
451449
OutputFile="$(SdkMSBuildExtensionsSwrFile)" />
@@ -466,9 +464,9 @@
466464
<Target Name="GenerateVSTemplateLocatorNupkg"
467465
DependsOnTargets="GenerateLayout;MsiTargetsSetupInputOutputs"
468466
Condition="'$(OS)' == 'Windows_NT' and '$(Architecture)' == 'x64' and ('$(DotNetBuild)' != 'true' or '$(DotNetBuildPass)' == '2')"
469-
Inputs="$(MSBuildExtensionsLayoutDirectory)/**/*;
470-
$(VSTemplateLocatorNuspecFile);
471-
$(GenerateNupkgPowershellScript)"
467+
Inputs="$(VSTemplateLocatorLayoutPath)/**/*;
468+
$(VSTemplateLocatorNuspecFile);
469+
$(GenerateNupkgPowershellScript)"
472470
Outputs="$(VSTemplateLocatorNupkgFile)">
473471
<Exec Command="powershell -NoProfile -NoLogo $(GenerateNupkgPowershellScript) ^
474472
'$(ArtifactsDir)' ^

src/Installer/redist-installer/targets/Versions.targets

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)