Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The expression "[MSBuild]::VersionGreaterThanOrEquals('', 9.0)" cannot be evaluated. Version string was not in a correct format on old C++ project #11302

Open
HO-COOH opened this issue Jan 19, 2025 · 6 comments
Assignees

Comments

@HO-COOH
Copy link

HO-COOH commented Jan 19, 2025

Issue Description

I am looking into this sample project provided by Microsoft, and got this error when I try to build it

Steps to Reproduce

  1. Clone https://github.com/microsoftarchive/msdn-code-gallery-microsoft
  2. cd into Official Windows Platform Sample/Direct2D basic image effects sample/[C++]-Direct2D basic image effects sample/C++
  3. Build the project either with visual studio 2022, or msbuild from native x64 tool command prompt

Expected Behavior

Builds fine.

Actual Behavior

D:\[C++]-Direct2D basic image effects sample\C++>msbuild
MSBuild version 17.12.12+1cce77968 for .NET Framework
Build started 1/20/2025 1:06:16 AM.

Project "D:\[C++]-Direct2D basic image effects sample\C++\D2DEffectsHelloWorld.sln" on n
ode 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|Win32".
Project "D:\[C++]-Direct2D basic image effects sample\C++\D2DEffectsHelloWorld.sln" (1)
is building "D:\[C++]-Direct2D basic image effects sample\C++\D2DEffectsHelloWorld.vcxpr
oj" (2) on node 1 (default targets).
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VisualStudio\v
17.0\AppxPackage\Microsoft.AppXPackage.Targets(225,25): error MSB4184: The expression "[
MSBuild]::VersionGreaterThanOrEquals('', 9.0)" cannot be evaluated. Version string was n
ot in a correct format. [D:\[C++]-Direct2D basic image effects sample\C++\D2DEffectsHell
oWorld.vcxproj]
Done Building Project "D:\[C++]-Direct2D basic image effects sample\C++\D2DEffectsHelloW
orld.vcxproj" (default targets) -- FAILED.

Analysis

No response

Versions & Configurations

No response

@YuliiaKovalova YuliiaKovalova self-assigned this Jan 22, 2025
@YuliiaKovalova
Copy link
Member

Hi @Sergio0694,

I see it's related to you recent changes in Microsoft.AppxPackage.targets
.

Could you please take a look? I have spotted several other tickets across the git caused by this change:
actions/runner-images#11016
actions/runner-images#11140

@Sergio0694
Copy link
Contributor

Hi @YuliiaKovalova! Yes this seems to be the bug that the commit you linked fixed. I think that's only available in VS 17.13 though (since that PR was merged in late November, after VS 17.12 had already released), and it wasn't backported.

@HO-COOH would it be possible for you to try this on VS 17.13 Preview 3 (it was released yesterday) and see if it's fixed there? 🙂

@rp9-next
Copy link

@YuliiaKovalova, @Sergio0694, thanks for identifying that this is in-fact a valid bug.
Since most GitHub VMs (and azure ones) have updated to VS 17.12, we have been somewhat blocked due to this.

Do you know any workarounds, that could help us get unblocked due to this issue in the meantime (while 17.13 GA gets released and adopted by VMs) ?

@HO-COOH
Copy link
Author

HO-COOH commented Jan 24, 2025

@HO-COOH would it be possible for you to try this on VS 17.13 Preview 3 (it was released yesterday) and see if it's fixed there? 🙂

Just tried, now I got

Build started at 8:46 PM...
1>------ Build started: Project: D2DEffectsHelloWorld, Configuration: Debug x64 ------
1>pch.cpp
1>D2DEffectsHelloWorld.cpp
1>SampleOverlay.cpp
1>DirectXBase.cpp
1>D2DEffectsHelloWorld.vcxproj -> D:\msdn-code-gallery-microsoft\Official Windows Platform Sample\Direct2D basic image effects sample\[C++]-Direct2D basic image effects sample\C++\x64\Debug\D2DEffectsHelloWorld\D2DEffectsHelloWorld.exe
1>D:\msdn-code-gallery-microsoft\Official Windows Platform Sample\Direct2D basic image effects sample\[C++]-Direct2D basic image effects sample\C++\x64\Debug\D2DEffectsHelloWorld\AppxManifest.xml : error APPX0501: Validation error. Element not found. (Exception from HRESULT: 0x80070490)
1>Done building project "D2DEffectsHelloWorld.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 8:46 PM and took 08.416 seconds ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
========== Deploy completed at 8:46 PM and took 08.417 seconds ==========

This is after I Retarget solution (otherwise it's windows 8.1 app that can't be build)

@Sergio0694
Copy link
Contributor

"Do you know any workarounds"

You should be able to avoid the error if you manually specify RuntimeIdentifiers in your project file.

"Just tried, now I got"

Mmh that seems to be a different error. Do you have a minimal repro you can share?

@HO-COOH
Copy link
Author

HO-COOH commented Jan 25, 2025

"Just tried, now I got"

Mmh that seems to be a different error. Do you have a minimal repro you can share?

@Sergio0694 Already have a reproduce in OP. This example project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants