Fody: Could not find path to weavers file


#1

My first attempt at installing Realm
Visual Studio 2017
Create new blank solution named Realm at C:\Repos
Add New Project: Windows Universal Blank App named UWP
Project Min Version 16299 Target Version 16299
Add Realm Nuget package 2.0.0
MSBUILD : error : Fody: Could not find path to weavers file. Searched ‘C:\Repos\Realm\FodyWeavers.xml’, ‘C:\Repos\Realm\UWP\FodyWeavers.xml’.


#2

Hi @Nosl, did you add the FodyWeavers.xml file yourself? As mentioned in the docs:

Note for UWP, .NET Core and other project.json-based projects: due to changes in NuGet 3.1, packages are no longer able to create content files, so FodyWeavers.xml will not be created automatically. You’ll need to manually create the file and paste the content above. Please refer to this post for more information.

If you read the installation section and didn’t think the instructions were clear enough, do you have any recommendations on how we can improve it so people have a better getting started experience?


#3

Thank you @nirinchev there is a bit to absorb there. I will explain how I got myself into trouble as this might help with the docs.

This is our initial exploration of Realm. We were drawn to Realm by our wish to offer our clients offline sync, but initially I wanted to explore how our model would change compared with the model we use with SQLite.

For this I didn’t think I would need the Realm Platform, only Realm Database, so I went straight to Realm Database in the docs. There is no section for UWP so I followed the instructions for getting started on Xamarin.

Here it says > The Realm package contains everything you need to use Realm.

I took that to mean all was good to go. I did see the note regarding project.json files, but UWP projects no longer use project.json, so the note appears to be no longer relevant.

As UWP projects no longer use project.json, will the Realm team develop an installer that deals with the fody weavers issue? Our company tends to prefer tools that do all that for us so that we can focus on providing business functionality to our customers.


#4

Thank you for the detailed description, definitely very valuable! Yes, seems like we can improve the wording of the note to indicate that the nuget limitation doesn’t apply just to project.json projects but to netstandard in general. Unfortunately there is little more that we can do as it’s a design decision by the Nuget team that affects all packages. We’ll try though :slight_smile:

Regarding the docs naming - it’s a legacy from the time when we only supported Xamarin and we haven’t gotten around to making it more clear that these docs apply to all .NET platforms. We’re working on it!


#5

Thank you @nirinchev. I’ve added FodyWeavers.xml to the root of the UWP project and now get a clean build.


#6

I have the same problem. I don’t have UWP in my project. I am using VIsual Studio for Mac. I deleted the created empty file reference for FodyWeavers.xml and created it again but now it shows I have two files of FodyWeavers.xml with the same name and when I run the project I get:

Error: Fody: Could not find path to weavers file. Searched ‘/Users/jassim/Projects/Jafaria/FodyWeavers.xml’, ‘/Users/jassim/Projects/Jafaria/Droid/FodyWeavers.xml’. (Jafaria.Droid)