Ok I am starting to bang my head on the table here.
I have used SubSonic for quite a while now, all on web apps. I am currently working on a console app and have got my classes generated fine, I can compile fine in VS 2005, I can even build using NAnt. However when I run the app I get this error:
An unhandled exception of type 'System.Configuration.ConfigurationErrorsException' occurred in SubSonic.dll
Additional information: Can't find the SubSonicService section of the application config file
I have created a very simple app to find the problem
I have the app.config set up as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="CoreRoutingConnectionString" connectionString="server=OSSKNO-STAGING;database=CORE_ROUTING;trusted_connection=true" providerName="System.Data.SqlClient" />
</connectionStrings>
<SubSonicService defaultProvider="CoreRoutingConnectionString">
<providers>
<clear/>
<add name="CoreRoutingConnectionString" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="CoreRoutingConnectionString" generatedNamespace="testSubsonic" includeTableList="tbl_Webservice_cancel_log" regexDictionaryReplace="tbl_Webservice_cancel_log,CancelLog;"/>
</providers>
</SubSonicService>
</configuration>
I read about SubSonic running in the context of a web app, so I have made reference to web.dll in my nant.build file like such:
<?xml version="1.0"?>
<project name="testSubsonic" default="build" basedir="." xmlns="http://nant.sf.net/schemas/nant.xsd">
<target name="build">
<delete dir="nant_build" />
<mkdir dir="nant_build" />
<csc target="exe" output="nant_build\testSubsonic.exe">
<sources>
<include name="Generated\AllStructs.cs" />
<include name="Generated\CancelLog.cs" />
<include name="Generated\CancelLogController.cs" />
<include name="Generated\StoredProcedures.cs" />
<include name="Program.cs" />
<include name="Properties\AssemblyInfo.cs" />
<include name="Program.cs" />
<include name="Generated\*.cs" />
</sources>
<references>
<include name="SubSonic.dll" />
<include name="System.dll" />
<include name="System.configuration.dll" />
<include name="System.Data.dll" />
<include name="System.Web.dll" />
<include name="System.Xml.dll" />
</references>
</csc>
<copy todir="nant_build">
<fileset basedir=".">
<include name="*.exe" />
<include name="*.config" />
<include name="*.dll" />
</fileset>
</copy>
</target>
</project>
I have even created a web.config with all the same info that is in the app.config. Does anybody know what I am doing wrong here. By the way this is using SubSonic version 2.1
This set up is the same as what is in my vs project file, why does it error when compiled with NAnt?
Thanks