Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 4fe1d0f

Browse files
committed
Simplify build/restore for nuget package for the VSIX
We previously had a complicated dependency between the VSIX and the build tasks so that we could build both as a project reference during command line builds, but have a project reference at design-time. There wasn't in the end much value in having the Tasks project in the VSIX solution, in fact, the contrary, since the tasks is backwards compatible with VS2015, whereas the VSIX targets VS2017 exclusively and therefore has incompatible MSBuild nuget package dependencies. By removing the project reference and simplifying the command line build, we just require the build to exist (building once the Build solution or build.cmd), we remove the complexity and make it easier to maintain moving forward. The restore has also switched to using MSBuild built-in restore capability, instead of using nuget.exe for projects.
1 parent de1f64b commit 4fe1d0f

6 files changed

Lines changed: 284 additions & 47 deletions

File tree

build.proj

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<RunCodeAnalysis Condition=" '$(RunCodeAnalysis)' == ''">false</RunCodeAnalysis>
1717
<IntermediateOutputPath>.nuget\</IntermediateOutputPath>
1818
<PackagesPath>$(IntermediateOutputPath)packages</PackagesPath>
19-
<CommonBuildProperties>WarningLevel=0;NoWarn=1591;Out=$(Out);Configuration=$(Configuration);RunCodeAnalysis=$(RunCodeAnalysis)</CommonBuildProperties>
19+
<CommonBuildProperties>WarningLevel=0;NoWarn=1591;Out=$(Out);Configuration=$(Configuration);RunCodeAnalysis=$(RunCodeAnalysis);PackOnBuild=true;;PackageOutputPath=$(Out)</CommonBuildProperties>
2020
<DefaultImportance Condition=" '$(DefaultImportance)' == '' ">high</DefaultImportance>
2121
<PS>%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe</PS>
2222
</PropertyGroup>
@@ -25,7 +25,7 @@
2525
<Solution Include="src\Build\NuGet.Build.Packaging.sln" />
2626
<Solution Include="src\VisualStudio\NuGet.Packaging.VisualStudio.15\NuGet.Packaging.VisualStudio.15.csproj" />
2727
<TestProject Include="src\Build\**\*Tests.csproj" />
28-
<PackSolution Include="src\VisualStudio\NuGet.Packaging.VisualStudio.15\NuGet.Packaging.VisualStudio.15.csproj" />
28+
<PackProject Include="src\VisualStudio\NuGet.Packaging.VisualStudio.15\NuGet.Packaging.VisualStudio.15.csproj" />
2929
</ItemGroup>
3030

3131
<Target Name="All" DependsOnTargets="Build;Test;Package" />
@@ -43,12 +43,12 @@
4343
<Exec Command="rmdir $(Out) /S /Q" Condition=" Exists('$(Out)') " ContinueOnError="true" StandardOutputImportance="low" />
4444
<MakeDir Directories="$(Out)" Condition="!Exists('$(Out)')" />
4545
<Message Text="Build properties: $(CommonBuildProperties)." Importance="high" />
46-
<MSBuild Projects="@(Solution)" BuildInParallel="false" Properties="$(CommonBuildProperties);PackOnBuild=false;CreateVsixContainer=false;DeployExtension=false" />
46+
<MSBuild Projects="@(Solution)" BuildInParallel="false" Properties="$(CommonBuildProperties);CreateVsixContainer=false;DeployExtension=false" />
4747
</Target>
4848

4949
<Target Name="Package" DependsOnTargets="Build">
5050
<MakeDir Directories="$(Out)" Condition="!Exists('$(Out)')" />
51-
<MSBuild Projects="@(PackSolution)" Properties="$(CommonBuildProperties);PackageOutputPath=$(Out);PackOnBuild=true" />
51+
<MSBuild Projects="@(PackProject)" Properties="$(CommonBuildProperties)" />
5252
<ItemGroup>
5353
<OutputFile Include="$(Out)\*.nupkg" />
5454
<OutputFile Include="$(Out)\*.vsix" />
@@ -74,15 +74,17 @@
7474
</Target>
7575

7676
<Target Name="Restore">
77+
<ItemGroup>
78+
<RestoreSolution Include="external\ApiIntersect\ApiIntersect.sln" />
79+
<RestoreSolution Include="src\Build\NuGet.Build.Packaging.sln" />
80+
<RestoreSolution Include="src\VisualStudio\NuGet.Packaging.VisualStudio.sln" />
81+
82+
<RestoreSolution Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_library_with_non_nugetized_reference\b.sln" />
83+
<RestoreSolution Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_multi_platform_solution\forms.sln" />
84+
<RestoreSolution Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_library_with_json_dependencies\a.csproj" />
85+
</ItemGroup>
7786

78-
<Exec Command='"$(NuGet)" Restore "external\ApiIntersect\ApiIntersect.sln" -Verbosity quiet' />
79-
<Exec Command='"$(NuGet)" Restore "src\Build\NuGet.Build.Packaging.sln" -Verbosity quiet -Config src\NuGet.Config' />
80-
<Exec Command='"$(NuGet)" Restore "src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_library_with_non_nugetized_reference\b.sln"' />
81-
<Exec Command='"$(NuGet)" Restore "src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_multi_platform_solution\forms.sln"' />
82-
<Exec Command='"$(NuGet)" Restore "src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_library_with_json_dependencies\project.json"' />
83-
84-
<!-- Ignore error code here since NuGet will detect an incompatibility between VS2017 ProjectSystem NuGet on MSBuild 15+, and the tasks' MSBuild 14, which is intentional -->
85-
<Exec Command='"$(NuGet)" Restore "src\VisualStudio\NuGet.Packaging.VisualStudio.sln" -Verbosity quiet -Config src\NuGet.Config' IgnoreExitCode='true' />
87+
<Exec Command='"$(MSBuildBinPath)\MSBuild.exe" /t:Restore "%(RestoreSolution.Identity)" /v:Minimal' />
8688
</Target>
8789

8890
<Target Name="Coverage" DependsOnTargets="Build">

0 commit comments

Comments
 (0)