How to fix AppCenter build error NETSDK1004 - xamarin.forms

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

Related

azure devops dotnet core app : why "dotnet restore" job fails?

I have an azure pipeline for a dotnet core app, and when it executes this job , i got:
2023-02-16T17:02:26.7325011Z 1>C:\hostedtoolcache\windows\dotnet\sdk\6.0.406\NuGet.targets(132,5): error : '6.1.6,6.2.3' is not a valid version string. [D:\a\1\s\WebApp\WebApp.csproj]
2023-02-16T17:02:26.7944327Z System.ArgumentException: '6.1.6,6.2.3' is not a valid version string.
2023-02-16T17:02:26.7945294Z at NuGet.Versioning.VersionRange.Parse(String value, Boolean allowFloating)
2023-02-16T17:02:26.7946303Z at NuGet.Versioning.VersionRange.Parse(String value)
2023-02-16T17:02:26.7947172Z at NuGet.Commands.MSBuildRestoreUtility.AddPackageReferences(PackageSpec spec, IEnumerable`1 items, Boolean isCpvmEnabled)
2023-02-16T17:02:26.7948010Z at NuGet.Commands.MSBuildRestoreUtility.GetPackageSpec(IEnumerable`1 items)
2023-02-16T17:02:26.7948973Z at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
2023-02-16T17:02:26.7949761Z at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
2023-02-16T17:02:26.7950412Z at NuGet.Commands.MSBuildRestoreUtility.GetDependencySpec(IEnumerable`1 items)
2023-02-16T17:02:26.7951037Z at NuGet.Build.Tasks.RestoreTask.ExecuteAsync(ILogger log)
2023-02-16T17:02:26.7951399Z Done executing task "RestoreTask" -- FAILED.
2023-02-16T17:02:26.7951774Z 1>Done building target "Restore" in project "WebApp.csproj" -- FAILED.
2023-02-16T17:02:26.7961752Z 1>Done Building Project "D:\a\1\s\WebApp\WebApp.csproj" (Restore target(s)) -- FAILED.
2023-02-16T17:02:26.8025517Z
2023-02-16T17:02:26.8026122Z Build FAILED.
2023-02-16T17:02:26.8029367Z
2023-02-16T17:02:26.8030306Z "D:\a\1\s\WebApp\WebApp.csproj" (Restore target) (1) ->
2023-02-16T17:02:26.8030690Z (Restore target) ->
2023-02-16T17:02:26.8031149Z C:\hostedtoolcache\windows\dotnet\sdk\6.0.406\NuGet.targets(132,5): error : '6.1.6,6.2.3' is not a valid version string. [D:\a\1\s\WebApp\WebApp.csproj]
2023-02-16T17:02:26.8031458Z
2023-02-16T17:02:26.8031674Z 0 Warning(s)
2023-02-16T17:02:26.8031958Z 1 Error(s)
2023-02-16T17:02:26.8033465Z
2023-02-16T17:02:26.8034195Z Time Elapsed 00:00:00.91
2023-02-16T17:02:26.8611133Z ##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
2023-02-16T17:02:26.8625609Z ##[error]Packages failed to restore
2023-02-16T17:02:26.8631699Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
2023-02-16T17:02:26.8710382Z ##[section]Finishing: Restore Nuget Packages
I am unable to figure out why, any help please ?
In your error you can see it says
System.ArgumentException: '6.1.6,6.2.3' is not a valid version string.
And indeed your problem is actually in this file: https://github.com/MohamedBenighil/WebAppWithDatabaseDemo/blob/055037f9f22bdac6db2edadeab01b412f3c4dca2/WebApp/WebApp.csproj
where you have that invalid Version string in your package reference:
<PackageReference Include="System.Management.Automation" Version="6.1.6,6.2.3" />

DotNet 6.0 publish error MSB4018: The process cannot access the file because it is being used by another process

The Error
When attempting to publish the app in the microsoft .NET 6.0 sdk container, the build fails with the following error:
System.IO.IOException: The process cannot access the file '/app/My-App/web.config' because it is being used by another process.
The failure occurs right after or towards the end of the React-JS frontend creation.
Here is the error in full:
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: The "TransformWebConfig" task failed unexpectedly. [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: System.IO.IOException: The process cannot access the file '/app/My-App/web.config' because it is being used by another process. [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite) [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite) [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.NET.Sdk.Publish.Tasks.TransformWebConfig.Execute() [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/app/My-App/My-App.csproj]
------
executor failed running [/bin/sh -c dotnet publish "My-App/My-App.csproj" -c Release -o /app/My-App]: exit code: 1
Dockerfile
Here is the relevant part of my Dockerfile. Since it is the build container, not much effort is made to keep it small.
Note that the build worked fine in a .NET 2.2 docker build using mcr.microsoft.com/dotnet/core/sdk:2.2. The errors only appeared after the migration to mcr.microsoft.com/dotnet/sdk:6.0
# ========= Build ASP.NET Core =========
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS dotnet_backend_build
RUN apt update && apt upgrade -y
RUN apt install -y curl wget make g++
# ========== Install Node ==========
RUN curl --silent --location https://deb.nodesource.com/setup_lts.x | bash -
RUN apt install -yq --no-install-recommends build-essential nodejs
# Node needs more memory during buildtime than default (=512)
ARG NODE_OPTIONS="--max-old-space-size=4096"
# ========= Installed Node =========
WORKDIR /app
COPY . .
RUN dotnet restore "./My-App/My-App.csproj"
RUN dotnet publish "My-App.csproj" -c Release -o /My-App/My-App
# ========= Built ASP.NET Core =========
What I've tried so far
Compilation on my local windows machine using MSBuild works fine.
dotnet publish Error: The process cannot access the file because it is being used by another process -> Not applicable, since I cannot run on a local machine
Add the command RUN dotnet build-server shutdown to line before dotnet publish
On a wild guess this solution The "TransformWebConfig" task failed unexpectedly - System.Exception: The acceptable value for AspNetCoreModuleHostingModel property is either
Copied the My-App.csproj to a separate layer before restoring, as seen in the Microsoft tutorial: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-6.0#the-dockerfile
Another promising option was this MSBuild error MSB4018 cannot access project.assets.json in NET 5 build However, since I am using the microsoft .NET 6 docker image, are MSBuild options even possible? I did not find the option in the dotnet publish documentation: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish Passing on the arguments -m -graph resulted in the same error message
In order to prevent timing issues, activate verbose logging as seen here: https://github.com/NuGet/Home/issues/11607 -> Added flag -v d to dotnet publish command. This results in presumably the same issue, but the output is clipped by docker due to a too high console log rate
I would appreciate any further pointers. Thank you in advance.
I struggled with this a bunch yesterday. Our problem was running a build in Github Actions. However, it boiled down to this:
In net 6.0, dotnet build is invoking msbuild with the -maxcpucount flag. According to MS docs, doing that means you're allowing msbuild to select a number for how many CPU cores to use to execute. However, the build issue you're having is because there are simultaneous processes trying to access the same file.
Consider adding -maxcpucount:1 to the end of your dotnet publish command. This switch will be passed to the underlying msbuild invocation, and should instruct it to be single-threaded, and hence not cause the file-access conflict you're seeing.

after installing image crop picker and debug problem

my all project is working fine but when i install image crop picker dependency then it shows the error even there is no build.
FAILURE: Build failed with an exception. Error given below
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
F:\bgbyteappfolder\newbgb\node_modules\react-native-image-crop-picker\android\build\intermediates\library_manifest\debug\AndroidManifest.xml:10:5-14:15: AAPT: error: unexpected element found in .
BUILD FAILED in 31s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API..
i Am expecting rapid action on this failure stackoverflow family
Upgrade your gradle version by adding classpath 'com.android.tools.build:gradle:4.0.1' in your android/build.gradle file:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
After this clean your build folder by:
cd android
./gradlew clean

VSTS - dotnet restore - PackageCache doesn't exist

I'm trying to build a .net core webapi project on a vsts hosted agent.
I use the same yaml accross multiple projects and it works fine:
- task: DotNetCoreCLI#1
displayName: Restore
inputs:
command: restore
projects: '$(ProjectName).Backend/*.csproj'
However, today, on a new project, the dotnet restore gave me the following error:
2018-06-23T09:23:21.5607282Z ##[section]Starting: Restore
2018-06-23T09:23:21.5610673Z ==============================================================================
2018-06-23T09:23:21.5610898Z Task : .NET Core
2018-06-23T09:23:21.5611078Z Description : Build, test and publish using dotnet core command-line.
2018-06-23T09:23:21.5611445Z Version : 1.0.2
2018-06-23T09:23:21.5612188Z Author : Microsoft Corporation
2018-06-23T09:23:21.5612456Z Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
2018-06-23T09:23:21.5613271Z ==============================================================================
2018-06-23T09:23:22.0071300Z [command]"C:\Program Files\dotnet\dotnet.exe" restore D:\a\1\s\MyApp.Backend\MyApp.Backend.csproj
2018-06-23T09:23:24.2324967Z Restoring packages for D:\a\1\s\MyApp.Backend\MyApp.Backend.csproj...
2018-06-23T09:23:24.5505741Z Restoring packages for D:\a\1\s\MyApp.Dtos\MyApp.Dtos.csproj...
2018-06-23T09:23:24.5506660Z C:\Program Files\dotnet\sdk\2.1.300\NuGet.targets(114,5): error : The local source 'D:\a\1\s\PackageCache' doesn't exist. [D:\a\1\s\MyApp.Backend\MyApp.Backend.csproj]
2018-06-23T09:23:25.8083235Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
2018-06-23T09:23:25.8094330Z ##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\MyApp.Backend\MyApp.Backend.csproj
2018-06-23T09:23:25.8105780Z ##[section]Finishing: Restore
While I don't understand why I got the error on that project and not on others, it disappeared once I upgraded the vsts task to DotNetCoreCLI#2.

The realm dot net base example does not compile

I am having trouble at getting the example "QuickJournal" to compile on iOS. The code compiles OK, but fails during the Fody step.
Goals
Try out the example application for .NET through the following
- Pull the repository
- Open the solution in examples/QuickJournal
- Compile and test
Expected Results
Smooth compilation & testing experience
Actual Results
Fody out of memory exception
Steps to Reproduce
See the setup, follow steps
I am using the latest Xamarin/Visual Studio Mac/XCode
Code Sample
The regular realm source code
Version of Realm and Tooling
git clone https://github.com/realm/realm-dotnet.git
git checkout 8f5e36ffd91e06b9c60b91f9de3fb312b411a4a4
The exception I am getting is
Fody: Found debug symbols at '~/realm-dotnet/examples/QuickJournal/QuickJournal/obj/Debug/QuickJournal.pdb'.
MSBUILD : error : Fody: An unhandled exception occurred:
MSBUILD : error : Exception:
MSBUILD : error : Out of memory
MSBUILD : error : StackTrace:
MSBUILD : error : at (wrapper alloc) System.Object:AllocVector (intptr,intptr)
MSBUILD : error : at Microsoft.Cci.Pdb.MsfDirectory..ctor (Microsoft.Cci.Pdb.PdbReader reader,
See log file
RealmCompilelog.txt
Realm 1.2.1 addresses that by using an updated version of Fody.
Answer for older Realm versions:
This is caused by a Cecil bug with Mono 5.0. As Realm depends on Fody, which uses Cecil, compilation will fail for project referencing it. Until new Cecil and Fody versions are released, the workaround is to revert to Mono 4.8:

Resources