title: "Could not load type" from app.config
body: <p>I've got a functioning program I inherited that works as a service at the moment.   All that service does is call a method in another class, so I'm trying to write a winform project I can run so I can work on itit.   I've copy+pasted the app.config file over and changed the name of the project over to servicetester, to a new non-service project.  I've also copied various bits of code other code from the service and it all builds.   I get the following message when I try and run the project using the line</p>
  
  <pre><code>var connectionManagerDataSection = ConfigurationManager.GetSection("CustomConfigurationSection") as clsCustomConfigurationSection;
  </code></pre>
  
  <p>message </p>
  
  <pre><code>An error occurred creating the configuration section handler for CustomConfigurationSection: Could not load type 'servicetester.Configuration.CustomConfigurationSect
  ion' from assembly 'servicetester'. (D:\\thepath\\servicetester\\bin\\Debug\\servicetester.vshost.exe.Config line 4)"
  </code></pre>
  
  <p>inner exception</p>
  
  <pre><code>"System.TypeLoadException: Could not load type 'servicetester.Configuration.CustomConfigurationSection' from assembly 'servicetester'.
     at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
     at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
     at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
     at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
     at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean&amp; isRootDeclaredHere)
  </code></pre>
  
  <p>This is the app.config which apart from the project name is the same as the original service project</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
      &lt;configuration&gt;
        &lt;configSections&gt;
        &lt;section name="CustomConfigurationSection" type="servicetester.Configuration.CustomConfigurationSection, servicetester" /&gt;
          &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt;
            &lt;section name="Proj.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
          &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
    &lt;startup&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /&gt;
    &lt;/startup&gt;
    &lt;CustomConfigurationSection&gt;
      &lt;EwsConfiguration username="a@b.com" password="letmein" version="2" emailStoreLocation="\\serverpath\" url="https://emailplace" subscriptionConnectionLifetime="15" debug="true"/&gt;
    &lt;/CustomConfigurationSection&gt;
    &lt;applicationSettings&gt;
      &lt;Proj.Properties.Settings&gt;
        &lt;setting name="Proj_Email_Log" serializeAs="String"&gt;
          &lt;value&gt;http://path&lt;/value&gt;
        &lt;/setting&gt;
      &lt;/Proj.Properties.Settings&gt;
    &lt;/applicationSettings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>There isn't a path to
  C:\Users\MYUSERNAME\AppData\Local\MYCOMPANY\MYAPP.exe_Url_longnastyhash9982749827349879\1.0.0.0\user.config
  or any other places along that lines I've read to try deleting</p>
  
  <p>I've cleaned and rebuilt everything</p>
  
  <p>The winform app is the same version as the service in terms of .NET framework
  Those are the most common things that Google says it can be.   Any other ideas?
  THanks</p>