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

msbuild: Set UseEnv variable to true #151

Closed

Conversation

TheComputerGuy96
Copy link

For some reason default Windows headers and libraries can't be found in an older project without those variables being set

Copy link
Owner

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ravenexp - Do you have any opinions on this?

@ravenexp
Copy link
Contributor

@ravenexp - Do you have any opinions on this?

These variables look like something the MSVC property files for C++ projects would set internally.
See for example MSBuild/Microsoft/VC/v170/Microsoft.Cpp.MSVC.Toolset.Win32.props.

Rather than overriding these globally, I'd first check if setting UseEnv solves the problem for the project in question:

https://learn.microsoft.com/en-us/cpp/build/reference/msbuild-visual-cpp-overview?view=msvc-170#useenv-property

@TheComputerGuy96

Does

msbuild /p:UseEnv=true

work for your project?

For some reason default Windows headers and libraries can't be found
in an older project without this variable being set
@TheComputerGuy96 TheComputerGuy96 changed the title msbuild: Add IncludePath and LibraryPath variables msbuild: Set UseEnv variable to true Nov 16, 2024
@TheComputerGuy96
Copy link
Author

@ravenexp UseEnv=true also works (so I set that by default instead)

@ravenexp
Copy link
Contributor

@ravenexp UseEnv=true also works (so I set that by default instead)

It's great that it works, but it should not be set by default because it effectively bypasses all configuration settings from the MSBuild project file.

Can you share your MSBuild project file or maybe just the configuration properties part without the source file names? I'll try to figure out what is missing from the msvc-wine MSBuild environment. I want to try to get to the root cause of this issue.

@TheComputerGuy96
Copy link
Author

@ravenexp
Copy link
Contributor

Ah, this must be it:

<PlatformToolset>v141_xp</PlatformToolset>

I've never tried targeting Windows 7, much less XP. I'll try to figure out what env vars are required to support this platform.

@TheComputerGuy96
Copy link
Author

I'm currently setting /p:PlatformToolset=v143 option to make that project build (and the SetEnv option of course)

@ravenexp
Copy link
Contributor

I'm currently setting /p:PlatformToolset=v143 option to make that project build (and the SetEnv option of course)

I've opened #152 to address the root cause of this bug. With it applied, your project should now build with:

msbuild /p:Platform=Win32 /p:PlatformToolset=v143 /p:WindowsTargetPlatformVersion=10.0

UseEnv is not required.

@TheComputerGuy96
Copy link
Author

@ravenexp I can confirm that MR solves the issue too (with that extra /p:WindowsTargetPlatformVersion=10.0 option; otherwise I get the same build error)

@ravenexp
Copy link
Contributor

@ravenexp I can confirm that MR solves the issue too (with that extra /p:WindowsTargetPlatformVersion=10.0 option; otherwise I get the same build error)

Then I suggest closing this in favor of #152, which solves the actual problem that prevented the needed WindowsTargetPlatformVersion override from working in msvc-wine.

@TheComputerGuy96
Copy link
Author

Superseeded by #152

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

Successfully merging this pull request may close these issues.

3 participants