Dotnet restore fails when ApplicationDisplayVersion has some values to configure Unit Test for MAUI
See original GitHub issueDescription
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
- Create a MAUI project
- Add net7.0 as a TargetFrameworks option:
<TargetFrameworks>net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
- Go to
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
and change the version to 1.5 or 1.5.0 - Try to restore packages:
dotnet restore
- 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:
- Created 8 months ago
- Comments:11 (4 by maintainers)
For now the easiest workaround is to add
<Version>$(ApplicationVersion)</Version>
in your project directly after your<ApplicationVersion>1.0</ApplicationVersion>
property.@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.