0

I was using WPF Windows and ADO.NET EF 6x, VS 2015 update 3. The error "No connection string named could be found in the application config file" only when the design time.

The image at design time But when I run it it was compiled without error and work perfectly. The image at run time

How to fix this?

My App.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </configSections>
    <connectionStrings>
        <add name="knightitEntities" connectionString="metadata=res://*/KnightModel.csdl|res://*/KnightModel.ssdl|res://*/KnightModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DESKTOP-ELNOS23;initial catalog=knightit;user id=user;password=password;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    </connectionStrings>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
    </startup>
    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
            <parameters>
                <parameter value="mssqllocaldb" />
            </parameters>
        </defaultConnectionFactory>
        <providers>
            <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
    </entityFramework>
</configuration>
HudsonPH
  • 1,838
  • 2
  • 22
  • 38
Red Wei
  • 854
  • 6
  • 22
  • 3
    Sidenote: **Never** share your database password online. – diiN__________ Jun 21 '16 at 08:56
  • Thank you for reminding me this diiN_ and HudsonPH – Red Wei Jun 21 '16 at 09:15
  • Possible duplicate of [No connection string named 'x' found in application config file... but it works?](https://stackoverflow.com/questions/38209933/no-connection-string-named-x-found-in-application-config-file-but-it-works) – Andrew Nix Nov 10 '17 at 11:46

0 Answers0