none
sgen: the specified module could not be found RRS feed

  • Question

  • my c# project have a reference to a managed c++ project (call it a.dll which definitely exists and is valid), and I set "Generate serialization assembly" to "On" in the c# project properties->Build because I want to try sgen improve xml serialization performance.

    However when I compile the c# project, there is an error:

    Could not load file or assembly 'a.dll' or one of its dependencies. The specified module could not be found.

    I googled a lot and got no luck, could you please help me?

    Appreciated for any comment.

    Note: I use Visual Studio 2013 and .net framework 4.0 on Windows 10.


    Sunday, February 19, 2017 3:37 PM

All replies

  • Hi,

    >> call it a.dll which definitely exists and is valid

    How did you check the dll valid? Based on your description, it seems you are using MSBuild, am I right?

    To narrow down this issue, I would suggest you share us below information.

    1. What is the type of C# project?
    2. If you run C# project with a.dll without sgen, will the project build correctly?

    Best Regards,

    Edward


    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.

    Monday, February 20, 2017 2:58 AM
  • Hi Edward,

    Thanks for your reply.

    My startup project is c# wpf program with .net framework 4.0, which have a reference to a.dll which is a managed c++ project.

    If I set "Generate serialization assembly" to Auto for the c# wpf program, everything works; but when I set it to "On", the error pops up.

    Actually I have not yet add sgen Task to .vcproject, just set it to On, others are not touched.

    Monday, February 20, 2017 6:23 AM
  • Hi,

    Do you mean you follow below steps, and get error?

    1. Add reference to a.dll

    2. set "Generate serialization assembly" as Auto

    3. Build->Build Solution

    If so, if you remove a.dll, will you get any error by following above steps?

    Best Regards,

    Edward


    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.

    Monday, February 20, 2017 6:27 AM
  • Hi,

    in the step 2, set "Generate serialization assembly" as On cause error.

    if set "Generate serialization assembly" as Auto, no error.

    Thanks

    Monday, February 20, 2017 9:06 AM
  • Hi,

    Sorry for this mistake. Will you get any error if you set "Generate serialization assembly" as On without a.dll? I assume a simple C++ dll would not cause this issue.

    I suggest you check whether below links will be help.

    #sgen.exe fails during build

    http://stackoverflow.com/questions/6623/sgen-exe-fails-during-build

    Best Regards,

    Edward


    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.

    Tuesday, February 21, 2017 1:54 AM