Xamarin IOS build fails when adding Firebase project (UnpackFrameworks Task Failed) - firebase

Working on my project and when I add Xamarin.Firebase.Messaging (or other firebase projects), I get the following error below when trying to build IOS only.
I tried deleting files in obj/bin, cleaning solution, rebuilding, restarting computer, going to regedit to enable longpaths, but nothing works. It seems like during the build, HotRestart unzips the framework file, then may try again and it wont overwrite and fails. When I uninstall the Firebase projects everything works perfectly. Been going crazy trying to figure this out!
Using Visual Studio 2022 trying to run on real device IphoneX.
2> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: The "UnpackFrameworks" task failed unexpectedly.
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: System.IO.IOException: The file 'obj\iPhone\Debug\Frameworks\FirebaseFirestore.framework\FirebaseFirestore' already exists.
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: at System.IO.FileInfo.CopyTo(String destFileName)
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: at Xamarin.iOS.Tasks.Windows.Zip.CopyDirectory(String source, String destination) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.iOS.Tasks.Windows/Zip.cs:line 32
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: at Xamarin.iOS.Tasks.Windows.Zip.Extract(String sourceFileName, String destinationPath) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.iOS.Tasks.Windows/Zip.cs:line 18
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: at Xamarin.iOS.HotRestart.Tasks.UnpackFrameworks.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/UnpackHotRestartFrameworks.cs:line 55
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets(75,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

The answer is in the below link.
https://github.com/CrossGeeks/FirebasePushNotificationPlugin/issues/437
Another workaround is to edit Xamarin.iOS.HotRestart.targets file:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.HotRestart.targets
Path depends on your VS version.
Search UnpackFrameworks node and add ContinueOnError="true". Like this:
<UnpackFrameworks ContinueOnError="true"
ReferencedAssemblies="#(AssembliesWithFrameworks)"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)">
<Output TaskParameter="Frameworks" ItemName="_UnpackedFramework" />
</UnpackFrameworks>

Related

Can't load Microsoft SQL Server Data Tools in Visual Studio 2013

When I start Visual Studio 2013 and click on SQL Server Object Explorer in Visual Studio 2013, I get this error:
The 'Microsoft SQL Server data tools' package did not load correctly. The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file C:\User[user Name]\App data\Roaming\Microsoft\visual studio\12.0\Activitylog.xml'.
Please help me.
I also get two more following errors:
1st) HRESULT E_Fail has been returned from a call to a COM component.
2nd) the system cannot find the file specified (Exception from HRESULT: 0*80070002)
and the Log files errors:
(sory the formatting is not good)
ERROR# 266 Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\MICROSOFT\SQLDB\VSIX\Microsoft.VisualStudio.Data.Tools.SQLPDWExtensions.dll
ERROR# 267 Could not load file or assembly 'Microsoft.SqlServer.RegSvrEnum, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\MICROSOFT\SQLDB\VSIX\Microsoft.VisualStudio.Data.Tools.SQLPDWExtensions.dll

How to fix AppCenter build error NETSDK1004

I decided to give a try to AppCenter CI to build my Xamarin project on Android & iOS.
However I have a build error that I don't meet when building directly in VisualStudio. Have you got any idea how to solve this prob ? Cause it tells me to run a Nuget Package restore, but during the build NugetPackage were restored.
Installed:
168 package(s) to packages.config projects
##[section]Finishing: Restore Nuget
##[section]Starting: Build Xamarin.Android project
error NETSDK1004: Assets file '/Users/vsts/agent/2.148.1/work/1/s/MyProject/MyProject/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/Users/vsts/agent/2.148.1/work/1/s/MyProject/MyProject/MyProject.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.99
##[error]Error: /Library/Frameworks/Mono.framework/Versions/5_16_0_0/bin/msbuild failed with return code: 1
Build output logs :
https://drive.google.com/open?id=1uWbhzDOEF6KoRlC8iGhD_ro9NEyeODu5
I checked the Target SDK version in the build setting in AppCenter, and I was targetting SDK 9.1 (Mono 5.16) ... But, I changed it to SDK 9.0 (Mono 5.12), so the one I'm targetting in my project, prob still here.
EDIT : I also noticed this error while appcenter restoring nuget package :
[command]/bin/bash -c /usr/bin/find . -name '*.sln' -type f -print0 | /usr/bin/xargs -0 grep -l '***.Droid.csproj' | /usr/bin/xargs -I '{}' nuget restore '{}' -DisableParallelProcessing
MSBuild auto-detection: using msbuild version '15.0' from '/Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin'.
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: The "WriteRestoreGraphTask" task failed unexpectedly. [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: NuGet.Commands.RestoreCommandException: PackageTargetFallback and AssetTargetFallback cannot be used together. Remove PackageTargetFallback(deprecated) references from the project environment. [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: at NuGet.Commands.AssetTargetFallbackUtility.EnsureValidFallback (System.Collections.Generic.IEnumerable`1[T] packageTargetFallback, System.Collections.Generic.IEnumerable`1[T] assetTargetFallback, System.String filePath) [0x0002d] in <55431ab4846b49babe0aafcf24cd67ed>:0 [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.AddPackageTargetFallbacks (NuGet.ProjectModel.PackageSpec spec, System.Collections.Generic.IEnumerable`1[T] items) [0x000cb] in <55431ab4846b49babe0aafcf24cd67ed>:0 [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.GetPackageSpec (System.Collections.Generic.IEnumerable`1[T] items) [0x002b3] in <55431ab4846b49babe0aafcf24cd67ed>:0 [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00048] in <cc3b329d40bd4675ae0e985e302972af>:0 [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].MoveNext () [0x0004e] in <cc3b329d40bd4675ae0e985e302972af>:0 [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.GetDependencySpec (System.Collections.Generic.IEnumerable`1[T] items) [0x001f8] in <55431ab4846b49babe0aafcf24cd67ed>:0 [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: at NuGet.Build.Tasks.WriteRestoreGraphTask.Execute () [0x000a5] in <55431ab4846b49babe0aafcf24cd67ed>:0 [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in <2338fdb301034c1d9c6b95e564d514b0>:0 [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/wnqwdckn.p7q.nugetrestore.targets(143,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteInstantiatedTask>d__26.MoveNext () [0x00212] in <2338fdb301034c1d9c6b95e564d514b0>:0 [/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/NuGetScratch/u4qrmymw.ehn.nugetinputs.targets]
WARNING: Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored.
Finally fixed my prob.
1/ I had an external assembly in my project that was not on nuget. I read that appcenter can't build a project / restore nuget if there is an assembly that does not depend on Nuget. So I updated this assembly with a nuget provided by the author.
2/ Edit I made with logs drove me on the right path.
The "WriteRestoreGraphTask" task failed unexpectedly
Solution to this is edit project .csproj and modify the line that allows fallback on .NET 4.5 from
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
to
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
Ref : https://intercom.help/appcenter/build/xamarin/xamarin-build-fails-with-the-writerestoregraphtask-task-failed-unexpectedly
Now I got a sucessfull build.
I had a similar error with NETSDK1004. It seems the project.assets.json never gets generated because of an earlier failure.
Error Generated
error NETSDK1004: Assets file '/Users/runner/work/1/s/.../project.assets.json' not found. Run a NuGet package restore to generate this file.
Actual Error
In my case there was an earlier error in 9_Restore_Nuget task for App Center: NETSDK1045.
error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.1.
I had put a DLL in there targeting net core 3.1 - App Center didn't like it & then failed the package restore.
So, the original error is true - project.assets.json isn't there but there is a reason & that needs exploring earlier in the build process.
I had a similar error: error netsdk1004 assets file 'C:\Users\username\source\repos\...\project.assets.json not found Run a NuGet package restore to generate this file.
All I had to do to fix it was open command prompt and then navigate to my project directory and run dotnet restore. This resolved the issue and I was able to successfully restore all .csproj files and thus build. Hope this helps!
This link helps: https://learn.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1004

I can't generate an IPA file from Visual Studio

I'm trying build my iOS application from Visual Studio for generate an IPA file, but I'm not having success.I set it up my provisioning profile, with my AppID etc, and when I try compile iOS application, gives following error:
"D:\AppNivel_Bkp_14032018_1450h\AppNivel\AppNivel.iOS\AppNivel.iOS.csproj"
(default target) (1) -> (_CodesignAppBundle target) -> C:\Program
Files (x86)\Microsoft Visual
Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(1930,3):
error :
/Users/user122749/Library/Caches/Xamarin/mtbs/Users/carlo/Desktop/IOS/AppNivel.iOS.app:
unknown error -1=ffffffffffffffff"

SqlPackage.exe is throwing an error that's breaking my deployment script

What does this error message mean? error MSB3073?
1>D:\BuildAgent\work\db3238a9996f31f9\DeployToEnvironment.proj(165,3): error MSB3073: The command ""C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\SqlPackage.exe" ^
D:\BuildAgent\work\db3238a9996f31f9\DeployToEnvironment.proj(165,3): error MSB3073: /Action:Publish ^

MSDeploy build after win upgrade

I am doing a msdeploy in the Developer Command Prompt (Admin) and after updating to Win 8.1 Pro, I get this error after running the command.
I did not get this error before the update I got another error USER NOT ADMIN to fix this I had to upgrade so I could create a group and add deploy as Admin.
Please forgive any bad formatting first timer.
>..\..\lib\msdeploy\msdeploy -verb:sync -source:package='Package.zip' -dest:contentPath='test.dev',computerName=localhost,userName=deploy,password=xxxx
Error: Exception has been thrown by the target of an invocation. ---> System.Exception: The type initializer for 'Microsoft.Web.Deployment.DeploymentManager' threw an exception. ---> System.Exception: The type initializer for 'Microsoft.Web.Deployment.BuiltInTypesCache' threw an exception. ---> System.Exception: The type initializer for 'Microsoft.Data.Tools.Schema.MsDeploy.MsDeployProviderBaseProviderFactory' threw an exception. ---> System.IO.IOException: Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Tools.Schema.Sql.dll' or one of its dependencies. Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) ---> System.Exception:Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
I believe this part of the error indicates you need to install, repair or uninstall/reinstall the 2012 version of the SQL Server Data Tools:
System.IO.IOException: Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Tools.Schema.Sql.dll' or one of its dependencies.

Resources