Link to home
Start Free TrialLog in
Avatar of Ruffone
Ruffone

asked on

Could not load file or assembly 'System.Configuration.ConfigurationManager,

Why might I getting this error. I am trying to connect to a DB from a console application and get this error.
FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Imports System.Data.Entity

Module Program

    Dim people As IEnumerable(Of Person) = New List(Of Person)

    Sub Main(ByVal args As String())
        Using context = New EFDbContext() '<--- Error here
            Dim repo As ITestRepository = New EFRepository(Of EFDbContext)(context)

        End Using

    End Sub
End Module

Public Class EFDbContext
    Inherits DbContext

        Public Sub New()
            MyBase.New("name=EFDbContext")
        End Sub

    Public Property People As DbSet(Of Person)

End Class

Open in new window

Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

System.Configuration.ConfigurationManager is not added as a reference by default. Add it and retry
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.