none
Build error on the server

    Question

  • Hello,

    I'm getting following error when building the code on the server:
    "error : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information"

    I dont get this error when building the code using Visual Studio .net on my local machine

    How do i resolve this error please?

    I tried setting CopyLocal to true for all the referenced dlls in my project but no  luck.

    Thanks.

    Thursday, March 8, 2018 10:55 PM

All replies

  • Hi ANi2000,

    Thanks for posting here.

    I have found a similar issue on Satckoverflow, I will also post the answer here so that can be beneficial to other community members reading this thread.

    If using serialization assemblies is not your requirement, you can set "Generate serialization assembly" to "Off". Go to Project Properties->Build->Generate serialization assembly, set the value to "Off" instead of "Auto".

    Source Debugging SGEN LoaderExceptions errors:

    The reason why this happens is that in Release builds, Visual Studio attempts to generate a serialization assembly containing the types in your solution, to improve XmlSerializer serialization performance, should you choose to serialize your types. This can be disabled by going to the Build tab of the project properties and setting "Generate serialization assembly" to "Off".

    After save this setting, then upload project to the Jenkins server to check if it works.


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 9, 2018 8:47 AM
  • Thanks Leo for the response.I tried with "Generate Serialization Assembly" setting to false.But no luck.I still get the same error when doing jenkins build.
    Friday, March 9, 2018 3:38 PM
  • @ANi2000, sorry late reply due to the weekend. Are make sure you have set the value to Off of “Generate Serialization Assembly” and make sure you have re-upload the project file to the build server. Because this setting is stored in the project file .csproj by following property:

      <PropertyGroup>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
      </PropertyGroup>

    If you make sure it. What I could suggest is try create a new blank project to check if it works fine on the server, if not, this issue should be related to the environment setting on the build server. If is works fine with the new project, this issue may more related to your project, you can have a look at the binding logs via assembly binding log viewer via fuslogvw.exe.

    Source: LoaderExceptions when building in Release mode – sgen.exe


    MSDN Community Support Please remember to click &quot;Mark as Answer&quot; the responses that resolved your issue, and to click &quot;Unmark as Answer&quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 12, 2018 8:14 AM