Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change <MauiVersion> in .csproj #38636

Open
MeestorX opened this issue Feb 7, 2024 · 7 comments
Open

Cannot change <MauiVersion> in .csproj #38636

MeestorX opened this issue Feb 7, 2024 · 7 comments
Assignees
Labels
Area-Workloads untriaged Request triage from a team member

Comments

@MeestorX
Copy link

MeestorX commented Feb 7, 2024

Description

I receive the following error if I add <MauiVersion></MauiVersion> to my .csproj:

The type or namespace name 'MauiUIApplicationDelegate' could not be found (are you missing a using directive or an assembly reference?) [{.csproj file name}::TargetFramework=net8.0-maccatalyst]

Steps to Reproduce

Create the default Maui Hybrid app
Add the line <MauiVersion>{whatever version of Maui you're currently running or any other version}</MauiVersion>
Run for MacCatalyst

In my case, I have 8.0.6 installed and without <MauiVersion> it runs properly.
The ONLY value that I can put for <MauiVersion> is 8.0.0-rc.1.9171. Any other value will cause the above error. e.g.
<MauiVersion>8.0.0-rc.1.9171</MauiVersion>

This "version string" matches the workload version. I cannot specify any OTHER version of Maui within .csproj to allow me to test a newer build.

Link to public reproduction project repository

No response

Version with bug

8.0.6

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

MacOS Sonoma

Did you find any workaround?

No response

Relevant log output

dotnet list package
Project 'VS2022' has the following package references
   [net8.0-ios16.1]: 
   Top-level Package                                      Requested            Resolved          
   > Microsoft.AspNetCore.Components.WebView.Maui         8.0.6                8.0.6             
   > Microsoft.Extensions.Logging.Debug                   8.0.0-rc.1.23419.4   8.0.0-rc.1.23419.4
   > Microsoft.Maui.Controls                              8.0.6                8.0.6             
   > Microsoft.Maui.Controls.Compatibility                8.0.6                8.0.6             
   > Microsoft.NET.ILLink.Tasks                     (A)   [8.0.1, )            8.0.1             

   [net8.0-maccatalyst16.1]: 
   Top-level Package                                      Requested            Resolved          
   > Microsoft.AspNetCore.Components.WebView.Maui         8.0.6                8.0.6             
   > Microsoft.Extensions.Logging.Debug                   8.0.0-rc.1.23419.4   8.0.0-rc.1.23419.4
   > Microsoft.Maui.Controls                              8.0.6                8.0.6             
   > Microsoft.Maui.Controls.Compatibility                8.0.6                8.0.6             
   > Microsoft.NET.ILLink.Tasks                     (A)   [8.0.1, )            8.0.1             

(A) : Auto-referenced package.

dotnet workload list
Installed Workload Id      Manifest Version                     Installation Source
-----------------------------------------------------------------------------------
maui-maccatalyst           8.0.0-rc.1.9171/8.0.100-rc.1         SDK 8.0.100        
ios                        16.4.8825-net8-rc1/8.0.100-rc.1      SDK 8.0.100        
maui                       8.0.0-rc.1.9171/8.0.100-rc.1         SDK 8.0.100        

Use `dotnet workload search` to find additional workloads to install.
@MeestorX MeestorX changed the title Cannot use <MauiVersion> in .csproj Cannot change <MauiVersion> in .csproj Feb 7, 2024
@MeestorX
Copy link
Author

MeestorX commented Feb 7, 2024

Is this the same issue?
dotnet/maui#20099

@drasticactions
Copy link

Are you referencing the Nuget packages in your project?

    <ItemGroup>
        <PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
        <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
        <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)" />
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
    </ItemGroup>

If you don't reference the nugets, changing MauiVersion will, I believe, change the Workload version. That's why it fails for you, since you only have that version installed. Also, you should really update to .NET SDK 8.0.1 and the newest Workloads (dotnet workload update), those are .NET 8.0 RC1 builds and are quite old.

@ghost
Copy link

ghost commented Feb 8, 2024

Hi @MeestorX. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

1 similar comment
@ghost
Copy link

ghost commented Feb 8, 2024

Hi @MeestorX. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@MeestorX
Copy link
Author

MeestorX commented Feb 8, 2024

Are you referencing the Nuget packages in your project?

Yes, those lines are still in there.
As I said, I just created the dotnet maui-blazor template (dotnet new maui-blazer) and only added the <MauiVersion> line to .csproj.

Also, you should really update to .NET SDK 8.0.1 and the newest Workloads (dotnet workload update), those are .NET 8.0 RC1 builds and are quite old.

I have run sudo dotnet workload update a few times. It doesn't make any changes. The version looks to be 8.0.100 in the workloads, but you can see I've got 8.0.6 for MauiControls.

@PureWeen PureWeen transferred this issue from dotnet/maui Feb 8, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Workloads untriaged Request triage from a team member labels Feb 8, 2024
@MeestorX
Copy link
Author

MeestorX commented Feb 8, 2024

So this is an SDK issue, not Maui? I noticed you moved it from Maui.

@MeestorX
Copy link
Author

Looks like the problem became widespread!
dotnet/maui#20600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Workloads untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants