Open janseris opened 2 years ago
Hmm I think we've seen issues like this before. I don't recall the conclusion.
@Eilon I saw #elif WINDOWS
not working issue with no solution and I have that issue as well (happens when I write #if ANDROID
#elif WINDOWS
with string variable declarations/definitions inside similarly to the example in this issue)
https://github.com/dotnet/maui/issues/6815#issuecomment-1136147134 <-- the #elif WINDOWS
issue
repro this issue on windows.
I'm having this issue as well. I'm running Windows 10.
With target OS set to 'Net 6.0' the code is greyed out in the NET 6.0 class library as shown below. The NET 6.0 console application is currently selected as the startup project and has reference to the NET 6.0 class library.
If I change the target OS to: 'net6.0-windows10.0.19041.0', then the code is no longer greyed out but it still doesn't get hit when I run the NET 6.0 console application on Windows (Debug mode). I've added a breakpoint before the #if WINDOWS and the breakpoint does get hit, but the code within the #if block doesn't get called.
I also tried changing the Target OS to 'Windows' from 'None' (on the NET 6.0 Console App) and that made no difference.
This is what my solution looks like
Any idea what I'm doing wrong?
Happy to provide more info where needed.
UPDATE
This is what the conditional complication symbols looks like for the NET 6.0 class library if this is relevant. They are the default values (unchanged since the creation of the class lib)
Adding WINDOWS to net6.0-windows10.0.19041.0 doesn't work either. But adding it to net6.0 does (but obviously affects all platforms)
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Verified this on Visual Studio Enterprise 17.7.0 Preview 1.0. Repro on Windows 11 with below Project: MauiApp11.zip
Facing a similar issue on VS for Mac (17.5.6 (build 3)) but with #elif IOS || MACCATALYST. It doesn't switch to elif code when iPhone is selected as target. It means "if" code (Android in my case) is always highlighted.
Description
When I select Windows Machine, the code does not compile. Expected behavior: When Windows Machine is selected to run the MAUI App, Visual Studio compiles the app for Windows.
The issue is not fixed when selecting
.net6.0-windows
from the dropdown in the code editor (I thought it would be fixed). IntelliSense syntax check passes but build error is still there and the application cannot be started. Clean/Rebuild does not help. Deletingbin
andobj
folders and then rebuilding does not help.Steps to Reproduce
MauiApp11.zip
Version with bug
6.0.400 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows 10
Did you find any workaround?
No response
Relevant log output
No response