Adding net6.0 to TargetFrameworks (for unit testing) can cause Debug Targets to be missing #9650
-
I just switched my Maui project from VS 2022 Preview (latest) to regular VS (17.3.2). I’m now having problems with the Debug Target portion of the standard toolbar. I’m seeing that “Windows Machine” is now the only available selection. While I can execute a Windows build, I’ve lost access to the android/ios emulators. I’ve attached an image showing what I see. The only seemingly non-standard thing I’ve done to the maui project file was to add net6.0 to the TargetFrameworks because I have a unit test project that is referencing the main maui project. This was all working fine in the preview. There is also a condition on OutputType: I created a new maui app using the standard Visual Studio template and it works great. Looking over the file diffs, nothing jumps out at being wrong. Doing some very minor edits to the csproj file (added a MessageTask to output a message after each build) and the problem seemed to go away briefly - but then I was in an odd state where I selected the net6.0-android framework but then trying to run the actual Pixel android emulator gave a: “Unable to start debugging. The startup project cannot be launched. Ensure that the correct project is set as the startup project. The startup project can be changed by selecting the 'Set as Startup Project' command from the right click menu in Solution Explorer.” Has anyone seen this, or know if any special voodoo is needed to fix it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Quick update on this. What I've found is that if I modify my main Maui app and remove net6.0 from TargetFrameworks and remove the condition from the OutputType, and then RESTART Visual Studio (restart required) - all the expected options are then displayed in the Debug Target dropdown: Weirdly enough, if I then re-add the above changes, everything still works - even after restarting Visual Studio. Also, this doesn't appear to be a VS preview vs VS standard issue. The same behavior happens on both. As I mentioned, the .net6.0 target is needed because I have an xunit test project that references my main maui app. (See https://www.youtube.com/watch?v=C9vIDLQwc7M&t=303s) |
Beta Was this translation helpful? Give feedback.
Quick update on this. What I've found is that if I modify my main Maui app and remove net6.0 from TargetFrameworks and remove the condition from the OutputType, and then RESTART Visual Studio (restart required) - all the expected options are then displayed in the Debug Target dropdown:
Weirdly enough, if I then re-add the above changes, everything still works - even after restarting Visual Studio. Also, this doesn't appear to be a VS preview vs VS standard issue. The same behavior happens on both.
As I mentioned, the .net6.0 target is needed because I have an xunit test project that references my main maui app. (See https://www.youtube.com/watch?v=C9vIDLQwc7M&t=303s)