Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/AppInstallerCLI.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32630.192
# Visual Studio Version 18
VisualStudioVersion = 18.0.11205.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "AppInstallerCLIPackage", "AppInstallerCLIPackage\AppInstallerCLIPackage.wapproj", "{6AA3791A-0713-4548-A357-87A323E7AC3A}"
ProjectSection(ProjectDependencies) = postProject
Expand Down Expand Up @@ -37,7 +37,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project", "Project", "{8D53
..\azure-pipelines.nuget.yml = ..\azure-pipelines.nuget.yml
..\azure-pipelines.yml = ..\azure-pipelines.yml
..\cgmanifest.json = ..\cgmanifest.json
Directory.Build.props = Directory.Build.props
Get-VcxprojNugetPackageVersions.ps1 = Get-VcxprojNugetPackageVersions.ps1
..\README.md = ..\README.md
..\doc\ReleaseNotes.md = ..\doc\ReleaseNotes.md
Expand Down Expand Up @@ -97,7 +96,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1A5D7A7D-5CB2-47D5-B40D-4E61CAEDC798}"
ProjectSection(SolutionItems) = preProject
CodeAnalysis.ruleset = CodeAnalysis.ruleset
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
Directory.Solution.props = Directory.Solution.props
nuget.config = nuget.config
stylecop.json = stylecop.json
vcpkg.json = vcpkg.json
Expand Down Expand Up @@ -1043,11 +1044,8 @@ Global
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Release|x86.ActiveCfg = Release|Win32
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.Release|x86.Build.0 = Release|Win32
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|ARM64.ActiveCfg = Release|ARM64
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|ARM64.Build.0 = Release|ARM64
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|x64.ActiveCfg = Release|x64
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|x64.Build.0 = Release|x64
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|x86.ActiveCfg = Release|Win32
{E5BCFF58-7D0C-4770-ABB9-AECE1027CD94}.ReleaseStatic|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 4 additions & 0 deletions src/Directory.Solution.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- This file is automatically included in the (autogenerated) project file for the solution. -->
<Project>
<Import Project="$(MSBuildProjectDirectory)\vcpkg.props" />
</Project>
45 changes: 44 additions & 1 deletion src/vcpkg.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>true</VcpkgEnableManifest>
<VcpkgInstalledDir>$(MSBuildThisFileDirectory)\vcpkg_installed</VcpkgInstalledDir>
<VcpkgInstalledDir>$(MSBuildThisFileDirectory)vcpkg_installed\</VcpkgInstalledDir>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<VcpkgTriplet>x64</VcpkgTriplet>
Expand Down Expand Up @@ -48,4 +48,47 @@
<VcpkgTriplet>x86-fuzzing</VcpkgTriplet>
<VcpkgConfiguration>Release</VcpkgConfiguration>
</PropertyGroup>

<!-- vcpkg can only install ports for one triplet at a time, so we need to ensure that every project using vcpkg uses the same triplet.
If there is a triplet mismatch, the ports for one of the triplets will be deleted when installing a second one.
In parallel builds, this can lead to projects that use the first triplet not being able to find the headers or binaries, and cause an error. -->

<PropertyGroup>
<!-- The MSBuild process starts with the solution file, and each individual project is built recursively from there.
When building the .sln, we will write a file to indicate which triplet should be used in all projects.
Each project will later read this file to verify that it is using the same triplet. -->
<_IsBuildingSln>$(MSBuildProjectName.EndsWith('.sln'))</_IsBuildingSln>
<_TripletFile>$(VcpkgInstalledDir).solution-triplet</_TripletFile>
</PropertyGroup>

<Target Name="WriteSolutionTripletToFile"
BeforeTargets="Build"
Condition="'$(_IsBuildingSln)' == 'true'">
<WriteLinesToFile File="$(_TripletFile)" Lines="$(VcpkgTriplet)" Overwrite="true" />
</Target>

<!-- Note: Visual Studio does not build the .sln in the same way that MSBuild.exe does, so the above target is not executed.
In that case we try to write the file on the first project we build.
There is a race condition for parallel builds in doing this, but it won't happen on pipeline builds... -->
<Target Name="WriteProjectTripletToFile"
BeforeTargets="EnsureNoTripletMismatch"
Condition="!Exists('$(_TripletFile)')">
<WriteLinesToFile File="$(_TripletFile)" Lines="$(VcpkgTriplet)" Overwrite="true" />
</Target>

<Target Name="EnsureNoTripletMismatch"
BeforeTargets="PrepareForBuild"
Condition="'$(_IsBuildingSln)' != 'true'" >

<ReadLinesFromFile File="$(_TripletFile)">
<Output TaskParameter="Lines" ItemName="_TripletFileLines" />
</ReadLinesFromFile>

<PropertyGroup>
<_SolutionTriplet>@(_TripletFileLines)</_SolutionTriplet>
</PropertyGroup>

<Error Condition=" '$(_SolutionTriplet)' != '$(VcpkgTriplet)' "
Text="The vcpkg triplet '$(VcpkgTriplet)' selected for project '$(MSBuildProjectName)' does not match with the solution triplet '$(_SolutionTriplet)'. If you are building from Visual Studio, try deleting the file '$(_TripletFile)'." />
</Target>
</Project>
Loading