Skip to content

Commit 0be0199

Browse files
authored
Fix fuzz build (microsoft#5932)
## Issue When the nuget references were moved forward, the fuzzing project was left out (because it didn't properly reference the C++/WinRT package). ## Change - Reference the C++/WinRT package properly - Update the version to match the rest of the repository - Update the Update script to skip projects with the correct version - Update the Update script to not add an extra newline
1 parent 23b033e commit 0be0199

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<PropertyGroup Label="Globals">
55
<CppWinRTOptimized>true</CppWinRTOptimized>
66
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
7+
<CppWinRTGenerateWindowsMetadata>false</CppWinRTGenerateWindowsMetadata>
78
<MinimalCoreWin>true</MinimalCoreWin>
89
<VCProjectVersion>15.0</VCProjectVersion>
910
<ProjectGuid>{5890d6ed-7c3b-40f3-b436-b54f640d9e65}</ProjectGuid>

src/Update-VcxprojNugetPackageVersions.ps1

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ function Update-PackagesConfig {
8686

8787
$currentVersion = $packageNode.version
8888

89+
# Skip if version is already the target version
90+
if ($currentVersion -eq $NewVersion) {
91+
Write-Verbose "Skipping $PackagesConfigPath - version is already $NewVersion"
92+
return $false
93+
}
94+
8995
if ($WhatIfMode) {
9096
Write-Host "WHATIF: Would update $PackagesConfigPath" -ForegroundColor Yellow
9197
Write-Host " Package: $PackageName" -ForegroundColor Cyan
@@ -126,6 +132,12 @@ function Update-VcxprojFile {
126132
return $false
127133
}
128134

135+
# Skip if version is already the target version
136+
if ($OldVersion -eq $NewVersion) {
137+
Write-Verbose "Skipping $VcxprojPath - version is already $NewVersion"
138+
return $false
139+
}
140+
129141
try {
130142
# Read the file content
131143
$content = Get-Content $VcxprojPath -Raw -ErrorAction Stop
@@ -164,7 +176,7 @@ function Update-VcxprojFile {
164176
$replacementCount = $originalMatches - $remainingMatches
165177

166178
# Save the updated content
167-
Set-Content $VcxprojPath -Value $updatedContent -Encoding UTF8 -ErrorAction Stop
179+
Set-Content $VcxprojPath -Value $updatedContent -NoNewline -Encoding UTF8 -ErrorAction Stop
168180

169181
Write-Host "Updated .vcxproj file: $VcxprojPath" -ForegroundColor Green
170182
Write-Host " Replaced $replacementCount reference(s): $oldPattern$newPattern" -ForegroundColor Cyan
@@ -230,7 +242,7 @@ try {
230242
# Group by project to avoid duplicate processing
231243
$projectGroups = $targetPackages | Group-Object ProjectFile
232244

233-
Write-Host "`nProjects to update:" -ForegroundColor Cyan
245+
Write-Host "`nProjects with package:" -ForegroundColor Cyan
234246
foreach ($group in $projectGroups) {
235247
$project = $group.Group[0] # Get the first package info for project details
236248
Write-Host " $($project.ProjectName) - Version(s): $($group.Group.Version -join ', ')" -ForegroundColor White

src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props')" />
3+
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
44
<ItemGroup Label="ProjectConfigurations">
55
<ProjectConfiguration Include="Fuzzing|x64">
66
<Configuration>Fuzzing</Configuration>
@@ -98,14 +98,14 @@
9898
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
9999
<ImportGroup Label="ExtensionTargets">
100100
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
101-
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
101+
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
102102
</ImportGroup>
103103
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
104104
<PropertyGroup>
105105
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
106106
</PropertyGroup>
107107
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
108-
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
109-
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
108+
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
109+
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
110110
</Target>
111111
</Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.250325.1" targetFramework="native" />
4+
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
45
</packages>

0 commit comments

Comments
 (0)