2

The problem is at follows. I'm working on my Bachelor's degree project in MAUI and I have to do some unit tests. I looked up online and found several tutorials that show the modification of the .csproj file. For reference I will provide this video from the MAUI Community Standup because it was the most recent I could find on the topic.

After the modification of the .csproj file, I'm getting errors about the "Platforms" folder missing from the project. In addition, the errors come from net8.0, even when I switch to net8.0-windows10.0.19041.0 from the drop down.

I currently do have some code that is Windows specific and I'm not sure if it is related. On a new project I was able to successfully perform the changes and run tests.

Thanks in advance.

Update 1: Since I noticed a user still asked for what was configured in the .csproj, the following line:

<TargetFrameworks>net8.0</TargetFrameworks>
...
<OutputType Condition="'$(TargetFramework)' != 'net8.0'">Exe</OutputType>

Do notice that I don't add Android, iOS and Mac. I currently just don't have the type to write the platform specific code for these platforms.

Update 2: By using the preprocessor directive #if !NET8_0 , I was able to remove the errors and even run a blank test. But now the project crashes on startup because it can't find the services for windows, even when the directive specifically declares that it shouldn't be just a net8.0 project.

3
  • Please show what exactly you have done. Commented Jun 14, 2024 at 14:31
  • @Julian sorry for the late response. In the .csproj I have added the following lines: - <TargetFrameworks>net8.0</TargetFrameworks> - <OutputType Condition="'$(TargetFramework)' != 'net8.0'">Exe</OutputType> Commented Jun 14, 2024 at 15:31
  • @Julian I updated the main thread, because the comments are too cramped. Commented Jun 14, 2024 at 15:45

1 Answer 1

0

The problem was with platform specific code. In my example, I had some NFC functionality for Windows. Wrapping all the segments in #if WINDOWS solved the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.