-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Can't publish a Maui app that references a class library on Windows without modifying the project #8304
Comments
I believe if you remove the following from the command line (without modifying the project file), this should work:
|
@dsplaisted unfortunately it doesn't because it also has the ios and android TFMs |
I suppose there is a lot of same, or it's the same same problem, I have.
The class library project reference can be added to the Maui project. Using VS it is possible to navigate to it (
Here The class library
Different issues come if I add |
@javiercn This issue does not repro when change the class library .csproj is |
@EmilyFeng97 Just to be very clear, the issue is that you should be able to have a class library with just I can't speak to the warning that you are seeing because that comes from the Windows SDK. If this is for manual testing purposes, I would stick to the workaround that I provided above. |
@javiercn as mentioned in the Docs for this
Try specifically to specify the .NET MAUI csproj to publish. Additionally, you should be able to use Let us know if that worked! |
Hi @javiercn. 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. |
@jfversluis I was not publishing the solution. I was publishing the Maui project. I do not think that calling MSBuild vs MSBuild Core (dotnet publish) makes a difference here. |
@javiercn the command you stated above does not reflect specifying the csproj. If you do not specify that explicitly it will try to publish the sln (or maybe each project in that folder individually, not really sure). You will have to specify the csproj in the command explicitly like so: |
Are you saying that it will walk up the directory hierarchy and try to build the solution? |
Let's put it this way: I have never seen it work if you don't specify the csproj explicitly :) This might be a good test case and if it appears to be that, let's find out where to log a but to maybe change that before for the dotnet CLI tooling |
@jfversluis I tried a few things and it does not make any difference.
The question then that I have is.
What command should a user run to produce a windows package that it can install in a machine |
Hm that's strange then. In that case I need to dive into it again for a bit! Thanks for the investigation on your part! |
@javiercn This issue also repro when publishing a Maui app that references a class library using the following command in Dev17.4 Preview 2 installed from PR412410. If I manually add "net6.0-android" to the SampleContent.csproj file and publish, this issue does not repro. Should I file a new bug to track this issue? |
@TanayParikh This issue repro on Dev17.4 Preview 2 installed from main branch when the MAUI project is created via CLI. And this issue does not repro if the MAUI project is created in VS. |
Thanks for the clarification. No we shouldn't ignore this issue if it repros on |
This issue is not specific to the PR branch, it also repro on VS installed from main branch when the MAUI project is created via CLI. So should I file a new issue now about publishing projects created via the CLI, or file a new issue when the issue still repro after #8304 is fixed? |
Thanks for the details @EmilyFeng97. Let's use this issue to track that as well. If after this issue is closed, projects created via CLI but published using VS are still failing, please create a new issue. |
Any news about this issue? dotnet build -c Release -f net6.0-android failed when building a .NET MAUI containing several class libraries targeting net6.0 results in the same error. |
@marcelbeeker which version of the SDK are you on ( I believe @jinzhao1127 may have mentioned this no longer reproduces. |
Have next steps:
Publish (via wizard): |
@Kazbek , Exactly that is my problem too. I cannot even add one .NET 6 project class library to my Maui Blazor app, and this exact same warning is presented to me. The build-solution even enters a state where it never completes. |
I'm curious but isn't the whole point of .NET to self contain everything in the one sdk? Shouldn't it all just work without any extra fiddling around and additional dependencies? |
I am facing the same problem as #8768 - considered as duplicate here, when publish in iOS. build command error log
on MAUI Blazor app .csproj
on the class library .csproj, I tried to add ;net7.0-ios;net7.0-android, but do not work, it has only 1 TargetFramework net7.0 as default.
The sdk folder above /Users/tranviettravel/Library/Caches/Xamarin/XMA/SDKs/dotnet/packs/Microsoft.iOS.Sdk/16.1.1481/ exists in my Mac, with contents inside. |
I have created a related ticket: |
Faced this issue again in VS2022 17.6.5. Fix was to close VS, then delete the .csproj.user file followed by the hidden ".vs" folder at solution path. Start VS, open project and rebuild. Issue resolved. |
Here is a weird solution. |
I'm getting this for .Net 7 even from github actions |
Hi @javiercn. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version. You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository. 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. |
Verified this issue with Visual Studio Enterprise 17.9.0 Preview 1.1. Not repro this issue. |
Still an issue on Edit: I created a simple repro showing this issue. https://github.com/AndreasReitberger/MauiPublishIssueWithClassLibRef
If removing the reference in the csproj file, it works. <ItemGroup>
<!-- Comment this line will make the app publishable
<ProjectReference Include="..\TestClassLibrary\TestClassLibrary.csproj" />
-->
</ItemGroup> If the same library is installed as nuget, it does work everytime. Output (with ref):
Output (without ref):
|
I was facing the same issue when publishing my .net 8 MAUI ios app to AppStore. I fixed it by setting the target framework to net8.0-ios for all of my C# class libraries as well:
|
I'm facing similar problem. I got a maui project X referencing a class library Y which is referencing another class library Z which is referencing Newtonsoft.Json (13.0.1) from the Microsoft.AspNet.WebApi.Client 6.0 package. am not sure if the following is related: |
So, we can't use any CI/CD for MAUI apps targeting window that references other custom class libraries? Any workarounds? |
Yes we can. I have a working AzureDevops pipeline which publish the MAUI app to AppCenter
Verzonden vanaf Outlook voor Android<https://aka.ms/AAb9ysg>
…________________________________
From: Rodrigo Juarez ***@***.***>
Sent: Saturday, February 24, 2024 10:22:41 PM
To: dotnet/maui ***@***.***>
Cc: marcelbeeker ***@***.***>; Mention ***@***.***>
Subject: Re: [dotnet/maui] Can't publish a Maui app that references a class library on Windows without modifying the project (Issue #8304)
So, we can't use any CI/CD for MAUI apps targeting window that references other custom class libraries? Any workarounds?
—
Reply to this email directly, view it on GitHub<#8304 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AENYSNTVFWF6GB4VQIOKVLTYVJK2DAVCNFSM5ZXSMAZKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJWGI3TGNBTGQ4Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@marcelbeeker can you link any examples of your configuration for the pipeline? |
I've build a Android .MAUI application. Below you will find my build pipeline. I'll hope this is enough information for you to solve your issues.
# Variable 'KeyStorePassword' was defined in the Variables tab
trigger:
branches:
include:
- refs/heads/master
- refs/heads/development
name: $(date:yyyyMMdd)$(rev:.r)
jobs:
- job: Phase_1
displayName: Phase 1
cancelTimeoutInMinutes: 1
pool:
vmImage: windows-latest
steps:
- checkout: self
- task: ***@***.***
displayName: Use .NET Core sdk 8.x
inputs:
version: 8.x
- task: ***@***.***
inputs:
nuGetServiceConnections: 'MyCryptoProvider'
- task: ***@***.***
displayName: Install Maui
inputs:
script: >
dotnet workload install maui --configfile nuget.config
- task: ***@***.***
name: NuGetToolInstaller2
displayName: Use NuGet 6.x
inputs:
versionSpec: 6.x
checkLatest: true
- task: ***@***.***
name: NuGetCommand3
displayName: NuGet restore
inputs:
solution: '**\*.sln'
feedRestore: 613d6b9d-285e-48ec-a9ce-004b0a3321ff/7cc32ed4-d773-4d44-8aaf-5d1f764362a4
searchPatternPush: $(Build.ArtifactStagingDirectory)/*.nupkg
- task: ***@***.***
displayName: dotnet publish
inputs:
command: publish
publishWebProjects: false
arguments: SecondMobileApp/SecondMobileApp.MAUI/SecondMobileApp.MAUI.csproj -c Release -f net8.0-android --no-restore
zipAfterPublish: false
modifyOutputPath: false
- task: ***@***.***
displayName: Copy Signed.abb file
inputs:
SourceFolder: $(agent.builddirectory)
Contents: '**/*-Signed.aab'
TargetFolder: $(build.artifactstagingdirectory)
flattenFolders: true
- task: ***@***.***
displayName: dotnet test
inputs:
command: test
projects: '**\*.sln'
arguments: -f net7.0
- task: ***@***.***
name: PublishBuildArtifacts8
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
TargetPath: '\\my\share\$(Build.DefinitionName)\$(Build.BuildNumber)'
...
Sent from Outlook<http://aka.ms/weboutlook>
…________________________________
From: Rodrigo Juarez ***@***.***>
Sent: Sunday, February 25, 2024 6:34 PM
To: dotnet/maui ***@***.***>
Cc: marcelbeeker ***@***.***>; Mention ***@***.***>
Subject: Re: [dotnet/maui] Can't publish a Maui app that references a class library on Windows without modifying the project (Issue #8304)
@marcelbeeker<https://github.com/marcelbeeker> can you link any examples of your configuration for the pipeline?
And regarding AppCenter, what type of application are you using? I wasn't even aware you could use appcenter with Windows MAUI apps (I don't even see the option in the new app dialog)
—
Reply to this email directly, view it on GitHub<#8304 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AENYSNQ43HBPBVSFJNIBQSLYVNY3LAVCNFSM5ZXSMAZKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJWGMYDAOBUGU3Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Description
A Maui app that references a class library can't be published without modifying the project file using the following command:
msbuild /restore /t:Publish /p:TargetFramework=net6.0-windows10.0.19041 /p:TargetFrameworks="net6.0-windows10.0.19041;net6.0" /p:configuration=release /p:GenerateAppxPackageOnBuild=true /p:AppxPackageSigningEnabled=true /p:PackageCertificateThumbprint="YOUR_CERT_THUMBPRINT_HERE" /p:PackageCertificatePassword="AnyTestPasswordYouLike"
Steps to reproduce
Workaround
msbuild /restore /t:Publish /p:configuration=Release /p:GenerateAppxPackageOnBuild=true /p:AppxPackageSigningEnabled=true /p:PackageCertificateThumbprint="<<YOURTHUMBPRINTHERE>>" /p:PackageCertificatePassword="AnyTestPasswordYouLike"
The text was updated successfully, but these errors were encountered: