none
"Could not parse the configuration file..." when adding or updating to a model in EF 6

    Question

  • I get an error when I add EF6 to a solution or add/update the model. I am using Database First approach. The error shows up in the Output window right after I add EF or add/update the model: "Could not parse the configuration file. The error message is: 'Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))' Try editing the file manually and then saving it."

    The "error" doesn't seem to have any influence on the compiling or running of the application (or the function of EF). However, an error like this is always disturbing when it's with the technology that is supposed to be the linchpin of your data management strategy.


    Michael

    Friday, October 31, 2014 1:31 PM

Answers

  • I believe that I have discovered the problem. I can repro it on my development machine and a couple of other dev machines.

    I am using VS 2013. The solution that I was using included a second project, a setup/deployment project, InstallShield Limited Edition Project. If I remove that project, the errors go away.

    If I create a new project, add EF via Nuget, add an EF model to the solution and then add this setup project I can repro the error. If you try it yourself, just remember you need to open VS and the solution, open the model in the designer, click anywhere in the whitespace of the design surface, the error should pop up in the Output. The details are up there in an earlier post.


    Michael

    Tuesday, November 4, 2014 2:42 PM

All replies

  • Maybe the config file is in some kind of a protected state, like the file is not checked-out with something like TFS has the file checked-in to its repository, and the file is read-only on the harddrive.
    Friday, October 31, 2014 6:27 PM
  • Well, I don't use TFS, the app is being developed on a single user machine. Which config file does the message refer to? App.Config? If I knew which config file I could check to see if it's in a protected state.

    Michael

    Friday, October 31, 2014 7:40 PM
  • Either app.config or the *.edmx file possibly. Maybe the user account doesn't write permission on the file or something. Go use Notepad or something on the files, change them and see if you can save them.
    Friday, October 31, 2014 8:04 PM
  • I'm able to open both files with notepad, edit and save.

    The apps compile and run fine. I just hate these odd error messages. Would like to figure this out.


    Michael

    Friday, October 31, 2014 11:16 PM
  • I have better repro'd the error. I have 2 different Solutions using EF (both 6.1), it only occurs with one of them as far as I can tell. It occurs after the following:

    Open the solution with VS

    Open the *.edmx in the designer (double click on file from solution explorer)

    Click on the white space anywhere on the designer's surface

    The error appears in the Output.

    If I clear the Output, I can compile, run, close *.edmx, re-open *.edmx, all without error. It seems this occurs only when I open VS, then the *.edmx, then click on the designer surface the first time.

    If I never open the *.edmx in the designer of VS, I never see the error in the Output window.


    Michael

    Friday, October 31, 2014 11:41 PM
  • Hello Michael,

    With your provided steps, I tried to reproduce this issue, however, whether I add a new model to the solution or add/update the model, it could work without any exception.

    I think it is what darnold mentions the config file is processed and not prepared for other code to parse.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, November 4, 2014 9:55 AM
    Moderator
  • Any suggestion on how to fix this problem? When I open the config files(app.config and ***.edmx) with notepad, I can edit and save. When I look at the file's properties with the file explorer, they are not marked as read-only. When I look at the Security tab I can see SYSTEM, Administrators, and myself as having full control. I'm not sure what to do next.

    Maybe there are files other than app.config and ***.edmx that I should look at for correct permissions. Can you suggest them?

    Also, I'm pretty sure that the problem does not lie within the database or the model itself. I am "adding" EF to an existing project with datasets. If I go back to an earlier version of my solution, without EF, add the EntityFramework package, and then Add\New Item\ADO.NET Entity Data Model to the solution, before I even select a "Choose Model Contents", the error comes up (so, I haven't even selected EF Designer from database yet!).

    There is something in my solution before I even add the ADO.NET Entity Data Model that seems to be the problem

    Michael



    Tuesday, November 4, 2014 11:19 AM
  • Another guy in a MSDN forum had a problem where he couldn't get the solution to work on one machine. He tried several things, and none of them worked. As a last resort, he had the machine rebuit and the solution started working.

    Hey, it is what it is. :)

    Tuesday, November 4, 2014 2:22 PM
  • I believe that I have discovered the problem. I can repro it on my development machine and a couple of other dev machines.

    I am using VS 2013. The solution that I was using included a second project, a setup/deployment project, InstallShield Limited Edition Project. If I remove that project, the errors go away.

    If I create a new project, add EF via Nuget, add an EF model to the solution and then add this setup project I can repro the error. If you try it yourself, just remember you need to open VS and the solution, open the model in the designer, click anywhere in the whitespace of the design surface, the error should pop up in the Output. The details are up there in an earlier post.


    Michael

    Tuesday, November 4, 2014 2:42 PM
  • I am using VS 2013. The solution that I was using included a second project, a setup/deployment project, InstallShield Limited Edition Project. If I remove that project, the errors go away.

    Well somehow InstallShield is protecting the config file. Why? Who knows?

    Tuesday, November 4, 2014 5:04 PM