question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dotnet restore fails when ApplicationDisplayVersion has some values to configure Unit Test for MAUI

See original GitHub issue

Description

Following links like https://www.youtube.com/watch?v=C9vIDLQwc7M&t=449s to configure xUnit Tests on my Maui App, I’m having problems to add net7.0 as a TargetFrameworks and add a condition to OutputType as Library to able xUnit Project test my classes.

dotnet restore fails when I add <ApplicationDisplayVersion>1.5.0</ApplicationDisplayVersion> 1.5.0 or 1.5 for the ApplicationDisplayVersion, if the value is 1.0.0 doens’t occurs. This is the error:

  "logs": [
    {
      "code": "NU1105",
      "level": "Error",
      "message": "Unable to read project information for 'Maui.UnitTestError': Sequence contains more than one element"
    }

I’ve been testing this for days and I figure it out that the ApplicationDisplayVersion is the problem, but I don’t have ideia why.

Steps to Reproduce

  1. Create a MAUI project
  2. Add net7.0 as a TargetFrameworks option: <TargetFrameworks>net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
  3. Go to <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> and change the version to 1.5 or 1.5.0
  4. Try to restore packages: dotnet restore
  5. Restore will fail and the file project.assets.json in obj folder will show the log error above.

Link to public reproduction project repository

https://github.com/danielancines/Maui.UnitTestError

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

dotnet 7.0.102 - VS Community 2022 17.4.4

Did you find any workaround?

I’m changing the version of my app using a config.json file.

Relevant log output

Severity	Code	Description	Project	File	Line	Suppression State
Error	NU1105	Unable to read project information for 'Maui.UnitTestError': Sequence contains more than one element	Maui.UnitTestError	C:\Users\danie\Documents\code\Maui.UnitTestError\Maui.UnitTestError\Maui.UnitTestError.csproj	1	
Error	NU1105	Unable to read project information for 'Maui.UnitTestError': Sequence contains more than one element	Maui.UnitTestError	C:\Users\danie\Documents\code\Maui.UnitTestError\Maui.UnitTestError\Maui.UnitTestError.csproj	1	
Error	NU1105	Unable to read project information for 'Maui.UnitTestError': Sequence contains more than one element	Maui.UnitTestError	C:\Users\danie\Documents\code\Maui.UnitTestError\Maui.UnitTestError\Maui.UnitTestError.csproj	1	
Error	NU1105	Unable to read project information for 'Maui.UnitTestError': Sequence contains more than one element	Maui.UnitTestError	C:\Users\danie\Documents\code\Maui.UnitTestError\Maui.UnitTestError\Maui.UnitTestError.csproj	1	
Error	NU1105	Unable to read project information for 'Maui.UnitTestError': Sequence contains more than one element	Maui.UnitTestError	C:\Users\danie\Documents\code\Maui.UnitTestError\Maui.UnitTestError\Maui.UnitTestError.csproj	1

Issue Analytics

  • State:closed
  • Created 8 months ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mattleibowcommented, May 24, 2023

For now the easiest workaround is to add <Version>$(ApplicationVersion)</Version> in your project directly after your <ApplicationVersion>1.0</ApplicationVersion> property.

1reaction
danielancinescommented, Feb 2, 2023

@Eilon I only changed the ApplicationDisplayVersion to 1.0.5 and the command dotnet restore, just that. I’ll try what @Redth wrote above and let you guys know.

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't use Microsoft.Maui.Storage.Preferences in unit testing
Hi, I am migrating one Xararin Forms project to MAUI. The application code works fine. On the unit testing side of it some...
Read more >
dotnet workload restore for MAUI fails with .NET 7
I was able to fix this by specifying the --source on the command. I think me having external nuget sources for private feeds...
Read more >
Untitled
In this blog, we'll visualize machine impact test results using the Syncfusion .NET MAUI Box and Whisker Chart. This control is supported on...
Read more >
Dotnet Maui Net Maui 7.0 | PDF | Hyper V | Xamarin
NET MAUI, you can create multi-platform apps using a single project, ... If your app fails to compile, review Troubleshooting known issues, which...
Read more >
Xamarin
I'm testing AndroidEnableProfiledAot on my Xamarin.Android project (it's not Xamarin.Forms). Unfortunately I haven't seen a single milisecond of improvement ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found