Could not load file or assembly EPiServer.Framework when building in Release

Vote:
 

Hi!

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=11.9.0.0, 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!

#196365
Aug 28, 2018 11:19
Vote:
 

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.

#196370
Aug 28, 2018 13:14
Vote:
 

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?

Thanks

#196373
Aug 28, 2018 14:14
Vote:
 

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.

#196374
Aug 28, 2018 14:24
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.