This project is read-only.

problem in exe project

Feb 4, 2014 at 12:32 PM
i am using NOF5.6, VS 2010. i need to add a console project in my solution. i did exactly told in the App Dev Manual. but without writing any line of code, after removing the program.cs file and downloading the nuget stuffs to the project - i build the whole solution and got ERROR in RunExe.cs file. the error is telling me that 'NakedObjects.Boot', 'NakedObjects.Core', 'NakedObjects.EntityObjectStore' doesn't exists in the namespace 'NakedObjects'.
I have tested this in NOF5.5 and the scenario is same.
So, please tell me what to do now.

Thanks in advance.
Feb 4, 2014 at 1:14 PM
First thing is to establish that the assemblies did in fact install correctly (via the NakedObjects.Batch NuGet packag): in the assembly references on the console project please confirm that you can see NakedObjects.Bootstrap.dll, NakedObjects.Core.dll (and several more).

If these assemblies do exist in the, but you are still getting the compile errors, my best guess is that it might be a .NET version issue. Do you have the same version of .NET specified on ALL your projects in the solution, including the console app - and if so, which version is that?
Marked as answer by momuis on 2/5/2014 at 2:14 AM
Feb 5, 2014 at 6:36 AM
thank you richard. all the dlls are there. what i found is, the newly added project's target framework was automatically set to '.NET Framework 4 Client Profile', but my other projects' profile is '.NET Framework 4' - this is the mismatch. Now its compiling and running with the following error:

{"The type initializer for 'NakedObjects.Boot.Run' threw an exception."}

"Failed obtaining configuration for Common.Logging from configuration section 'common/logging'."

at Common.Logging.Configuration.ArgUtils.Guard[T](Function`1 function, String messageFormat, Object[] args) in c:_prj\common-logging\src\Common.Logging\Logging\Configuration\ArgUtils.cs:line 312
at Common.Logging.Configuration.ArgUtils.Guard(Action action, String messageFormat, Object[] args) in c:_prj\common-logging\src\Common.Logging\Logging\Configuration\ArgUtils.cs:line 276
at Common.Logging.LogManager.BuildLoggerFactoryAdapter() in c:_prj\common-logging\src\Common.Logging\Logging\LogManager.cs:line 251
at Common.Logging.LogManager.get_Adapter() in c:_prj\common-logging\src\Common.Logging\Logging\LogManager.cs:line 168
at Common.Logging.LogManager.GetLogger(Type type) in c:_prj\common-logging\src\Common.Logging\Logging\LogManager.cs:line 227
at NakedObjects.Boot.Run..cctor()

any suggestion?
Feb 5, 2014 at 8:30 AM
That's puzzling because error suggests it is failing to find the logging configuration yet, as far as I can see, logging is hard-wired off in RunBatch (something we should probably change, to allow it to be overridden).

Before going further though, let's just make sure that this is not a side-effect of your previous change. Did you try creating the run project again from scratch, this time starting with .NET 4.0 and then installing NakedObjects.Batch ? (Doesn't seem a likely cause, but then I have recently installed and run NakedObjects.Batch with no problems).
Marked as answer by momuis on 2/5/2014 at 2:14 AM
Feb 5, 2014 at 10:14 AM
Edited Feb 5, 2014 at 10:16 AM
i have done the whole process from the scratch as you suggested and its working. i have tested a file write process within the 'Execute()' method by creating a constructor within 'BatchStartPoint' class which is calling this method. its writing the file.
but pls tell me that is this the right way to create constructor and call the Execute() method? or there is other standard approach?

now, i can start my project work by writing data to the database.

Thank you.
Feb 5, 2014 at 12:56 PM
Edited Feb 5, 2014 at 12:57 PM
well, now i have another biting issue...
the Container is null.
as per manual, i have created the Container injected item within the batchstart class and used to list my entity-objects. but its firing exception as null object reference. this is surprising to me as i included domain reference in the project.
moreover, i tried to insert data directly by using dbcontext instance... in that case, there is no exception, but data is not inserting in the db.

i am now in great surprise. any suggestion?

Feb 5, 2014 at 1:53 PM
Please post code for your batch start class, and also for your RunExe class.

As a more general comment: if all you are doing in this console app is writing data to the database, you do not need to be using Naked Objects for it - you could write a conventional console app that just uses the DbContext (don't install Naked Objects into that project at all). N.B. But if you are running within any Naked Objects app (.exe or MVC) you should not then deal with the DbContext directly - use the Container as you were.
Feb 6, 2014 at 5:46 AM
I am getting the 'Container' null. please see the following code:

public class BatchStartPoint : IBatchStartPoint {
        public IDomainObjectContainer Container { set; protected get; }

        public BatchStartPoint()

        public void Execute() {
            List<ContactType> ct = Container.Instances<ContactType>().ToList();
public class RunExe : RunBatch {

        protected override IServicesInstaller MenuServices {
            get {
                return new ServicesInstaller(new AsyncService());

        protected override IServicesInstaller ContributedActions {
            get { return new ServicesInstaller(); }

        protected override IObjectPersistorInstaller Persistor {
            get {
                var installer = new EntityPersistorInstaller();
                installer.UsingCodeFirstContext(() => new MyDbContext());
                return installer;

        public static void Run() {
            new RunExe().Start(new BatchStartPoint());
Feb 6, 2014 at 7:38 AM
Edited Feb 6, 2014 at 7:39 AM
The problem is caused by your adding a constructor into the BatchStartPoint i.e.
        public BatchStartPoint()
What's happening is that you are pre-empting the call to Execute - before Naked Objects has had a chance to set the object up properly, which includes injecting the services. If you take this constructor out altogether it should run fine - Naked Objects knows (because of the implementation of IBatchStartPoint) that it needs to invoke Execute once the object is set up.

In general there is no need to write constructors in Naked Objects coding - and adding logic into constructors can cause problems like this.
Marked as answer by momuis on 2/6/2014 at 12:29 AM
Feb 6, 2014 at 8:29 AM
Edited Feb 6, 2014 at 8:32 AM
well, i have removed the constructor and yes, its working. but when i started debugging - the list is empty with no exception. i have added my model-project's reference to the console app. it is the scenario of without adding the connectionstring in the app.config.

but if i add the connectionstring to that file, following exceptions occurred, this is occurred in the 'RunExe' file at the line: new RunExe().Start(new BatchStartPoint());

{"The type initializer for 'NakedObjects.Boot.Run' threw an exception."}

"Failed obtaining configuration for Common.Logging from configuration section 'common/logging'."

at NakedObjects.Boot.Run..ctor()
at NakedObjects.Boot.RunStandaloneBase..ctor()
at NakedObjects.Boot.RunBatch..ctor()
at NovoComCMSService.RunExe..ctor()
at NovoComCMSService.RunExe.Run() in D:\NovoCom\CMS\Phase2_Working_NOF56_20140106\NovoComCMSService\RunExe.cs:line 36
at NovoComCMSService.Program.Main(String[] args) in D:\NovoCom\CMS\Phase2_Working_NOF56_20140106\NovoComCMSService\Program.cs:line 4
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Now, what to do? pls suggest...
Feb 6, 2014 at 8:43 AM
There is something wrong with the intialization, almost certainly a database issue.

The best way is not to debug this as a batch application, but to run essentially the same code as a regular Naked Objects MVC application - where you should get clearer messages about what you are doing wrong.

Please confirm that you have already had a Naked Objects MVC application running with exactly the same domain model, database schema etc. Don't try to do anything new in the model and debug it from batch - you should add batch only at the end when the online is all OK. (If all you want to do is add some data, you could use Fixtures - see manual).

Alternatively/additionally run in debug mode and set to break on all exceptions - as this would give you more of a clue what is really breaking (likely to be either a connection string issue, or an EF mapping issue) - the exception you are actually seeing is just a generic initialization exception - saying that it has failed to start up correctly.
Feb 6, 2014 at 9:43 AM
my solution has 5 projects: XAT, Batch, 2 web projects and a model project. all are usually using the same model.

only the newly introduced feature - Audit is using a separate db. except this, all are using the same dbcontext and same model.