Using SubSonic Active Record in a seperate assembly from the Web

subsonicsubsonic3

I'm following the tutorial here.

I created a new Web Application. I then added two Class Library projects, Common and Domain. The common project contains the SubSonic library while the Domain project contains the SubSonic .tt and .ttinclude files.

After modifying the settings in Settings.ttinclude, I try to 'Run custom tool' on the tt files and I get this error:

Running transformation: System.ArgumentNullException: Value cannot be null. 
Parameter name: The project does not contain App.config or Web.config file.

I can provide the rest of the stack trace, but it appears that it can't find my Web.config which was the connection string. Adding an app.config to the Domain project just causes the generation step to complain about not finding expected sections.

Is there a way to have these files in a separate assembly but still use the web.config for settings?

Best Answer

You need to place an App.config in the project you want to generate from. Yes, it's redundant but there's no other way to handle this with T4