maui
maui copied to clipboard
Ios build fails in Azure
Description
Running build targeting ios in Azure pipeline after signing in build step appsettings.json : error : The path '../../../../../../../work/1/s/[NAME]/appsettings.json' would result in a file outside of the app bundle and cannot be used. [/Users/runner/work/1/s/[NAME]/[NAME].csproj] appsettings.json : error : [/Users/runner/work/1/s/[NAME]/[NAME].App.csproj] Web/typescript/package-lock.json : error : The path '../../../../../../../work/1/s/[NAME]/Web/typescript/package-lock.json' would result in a file outside of the app bundle and cannot be used. [/Users/runner/work/1/s/[NAME]/[NAME].App.csproj] Web/typescript/package-lock.json : error : [/Users/runner/work/1/s/[NAME]/[NAME].App.csproj] Web/typescript/package.json : error : The path '../../../../../../../work/1/s/[NAME].App/Web/typescript/package.json' would result in a file outside of the app bundle and cannot be used. [/Users/runner/work/1/s/[NAME].App/[NAME].App.csproj] Web/typescript/package.json : error : [/Users/runner/work/1/s/[NAME].App/[NAME].App.csproj] Web/typescript/tsconfig.json : error : The path '../../../../../../../work/1/s/[NAME].App/Web/typescript/tsconfig.json' would result in a file outside of the app bundle and cannot be used. [/Users/runner/work/1/s/[NAME].App/[NAME].App.csproj] Web/typescript/tsconfig.json : error : [/Users/runner/work/1/s/[NAME].App/[NAME].App.csproj]
identifier changed to [NAME]
This stops the build process ...
Steps to Reproduce
Setup build pipe , I used the following template
trigger:
- master
pool: vmImage: macos-latest
steps:
-
task: InstallAppleCertificate@2 inputs: certSecureFile: 'MyDistributionCertificate.p12' certPwd: '$(certificatePassword)' keychain: 'temp'
-
task: InstallAppleProvisioningProfile@1 inputs: provisioningProfileLocation: 'secureFiles' provProfileSecureFile: 'MyProvisioningProfile.mobileprovision'
-
task: UseDotNet@2 inputs: packageType: 'sdk' version: '6.x'
-
task: CmdLine@2 displayName: 'dotnet workload install maui' inputs: script: 'dotnet workload install maui'
-
task: DotNetCoreCLI@2 displayName: 'dotnet publish (Release)' inputs: command: 'publish' publishWebProjects: false projects: 'MyMAUIProject.sln' arguments: '-f:net6.0-ios -c:Release /p:ArchiveOnBuild=true /p:EnableAssemblyILStripping=false' zipAfterPublish: false modifyOutputPath: false
-
task: CopyFiles@2 inputs: SourceFolder: '$(Agent.BuildDirectory)' Contents: '**/*.ipa' TargetFolder: '$(Build.ArtifactStagingDirectory)' flattenFolders: true
-
task: PublishBuildArtifacts@1 inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)' ArtifactName: 'drop' publishLocation: 'Container'
Set up signing .
Run pipe .
Link to public reproduction project repository
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
macos-latest , Ios
Did you find any workaround?
No
Relevant log output
appsettings.json : error : The path '../../../../../../../work/1/s/[NAME]/appsettings.json' would result in a file outside of the app bundle and cannot be used. [/Users/runner/work/1/s/[NAME]/[NAME].csproj]
appsettings.json : error : [/Users/runner/work/1/s/[NAME]/[NAME].App.csproj]
Web/typescript/package-lock.json : error : The path '../../../../../../../work/1/s/[NAME]/Web/typescript/package-lock.json' would result in a file outside of the app bundle and cannot be used. [/Users/runner/work/1/s/[NAME]/[NAME].App.csproj]
Web/typescript/package-lock.json : error : [/Users/runner/work/1/s/[NAME]/[NAME].App.csproj]
Web/typescript/package.json : error : The path '../../../../../../../work/1/s/[NAME].App/Web/typescript/package.json' would result in a file outside of the app bundle and cannot be used. [/Users/runner/work/1/s/[NAME].App/[NAME].App.csproj]
Web/typescript/package.json : error : [/Users/runner/work/1/s/[NAME].App/[NAME].App.csproj]
Web/typescript/tsconfig.json : error : The path '../../../../../../../work/1/s/[NAME].App/Web/typescript/tsconfig.json' would result in a file outside of the app bundle and cannot be used. [/Users/runner/work/1/s/[NAME].App/[NAME].App.csproj]
Web/typescript/tsconfig.json : error : [/Users/runner/work/1/s/[NAME].App/[NAME].App.csproj]
I have the same kind of error with libman, i think it happens with any .json file (in my case at least) in the root of the project.
It has content as build action, don't know if it's the correct one.
For libman.json I'm able to exclude it in the csproj and then do libman restore if needed...
@rolfbjarne @mattleibow thoughts?
It has
contentas build action, don't know if it's the correct one.
If you don't want the file copied to the app bundle, then use None as the build action.
If you want the file copied to the app bundle, then you'll probably have to set the Link metadata on the item to where in the app bundle you want the file copied (see https://github.com/xamarin/xamarin-macios/blob/main/dotnet/BundleContents.md for more information).
Thanks! I will look in to the link meta data. I do think the files are needed but will test and see.
It has
contentas build action, don't know if it's the correct one.If you don't want the file copied to the app bundle, then use
Noneas the build action.If you want the file copied to the app bundle, then you'll probably have to set the
Linkmetadata on the item to where in the app bundle you want the file copied (see https://github.com/xamarin/xamarin-macios/blob/main/dotnet/BundleContents.md for more information).
I have the problem with this (and indeed it happens to all JSON Content files). Problem is, in order for TypeScript build to work, tsconfig.json has to be of Content Build action. Any workaround beside removing Microsoft.TypeScript.MSBuild and running tsc manually?
@datvm you can also set the PublishFolderType=None metadata on the items to prevent them from being copied to the app bundle:
<Content Include="tsconfig.json" PublishFolderType="None" />
@rolfbjarne thanks it works!