We are experiencing problems i some of our projects when building in Release configuration in Visual Studion 2017:
Could not load file or assembly 'EPiServer.Framework, Version=18.104.22.168, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' or one of its dependencies. The system cannot find the file specified.Our site is running version 11.9.4 of EPiServer but whe have experienced this with other versions as well. Building the project with Debug configuration works. The usual measurments such as cleaning bin/obj/temp folders, clean build, restart VS etc. does not solve this as you can clone the project from git into a new folder or computer, restore nuget-packages and build the solution with Release configuration to reproduce this error.
During our investigations we have discovered that setting "Generate serialization assembly" to "Off" in "Project properties->Build" works as a workaround. But we are uncertain if doing this may have impact on the site's performance or have other undesirable side effects.
Are there anyone else that have experienced the same problem and can explain why this happens and what to do about it? Any help is appreciated!
I think that is just used for Xml Serialization. That is if you xml serialize/deserialize any types from your project you will get a perfromance hit for the first call (since it will then dynamically generate such a serialization assembly), but that will then be loaded in app-domain for later use. If you do not use xml serialization I dont think you get any performance hit.
This is what I'm thinking as well, but I would feel safer if I knew. As of what I'm aware of we are not using xml serialization/deserialization in our project, but what if EPiServer or any other referenced assembly does?
I would not be to worried, if anything uses it is a one-time cost (per application lifetime).
You could profile the application for your most common scenarios and see if Xml serialization is a substantial cost. If so, then it is possible to generate the Xml serializable assembly by calling sgen.exe (https://docs.microsoft.com/en-us/dotnet/standard/serialization/xml-serializer-generator-tool-sgen-exe) your self.