Error generating code.

Dec 14, 2009 at 1:11 PM

While doing the hands on labs and trying to generate code for the model, I get the following error:

Error 10 There was a problem creating and initializing the processor for a directive named 'ModelInjector'. The type of the processor is Microsoft.Practices.Modeling.CodeGeneration.Strategies.TextTemplating.ModelInjectorDirectiveProcessor. The transformation will not be run.  The following Exception was thrown:

System.MissingMethodException: Method not found: 'Void Microsoft.CSharp.CSharpCodeProvider..ctor(System.Collections.Generic.IDictionary`2<System.String,System.String>)'.

   at Microsoft.VisualStudio.TextTemplating.TemplateProcessingSession.get_CodeDomProvider()

   at Microsoft.VisualStudio.TextTemplating.Engine.ProcessCustomDirectives(ITextTemplatingEngineHost host, TemplateProcessingSession session, List`1 directivesToBeProcessed)  0 0


Any ideas?

Dec 15, 2009 at 10:26 PM


Can you specify which version of VS are you using and also which lab is throwing this error?

Regards, Hernan

Dec 15, 2009 at 10:59 PM


VS 2008 and Lab 5 (and yes I use the labs for VS 2008)



Dec 18, 2009 at 12:15 PM

Any one? Any ideas?

Dec 19, 2009 at 3:22 AM

Do you have VS2010 also installed along with VS2008?

On the other hand, could you run fine the previous labs?

Did you add any modification to the original lab 5?

Dec 19, 2009 at 9:11 AM


No Just VS 2008 Pro with SP1

All the labs went great, the problem occurred only when I tried to generate the code.

I followed the lab as it is. Even I had a look on the after folder for Lab 5, and when I tried to re-generate the code the same error thrown.

I am using windows Vista Ult. Does that make any difference?

Dec 24, 2009 at 12:19 PM

For some reason that is hard to figure out, the CSharpCodeProvider constructor with the generic dictionary is throwing and exception. This may be caused by an issue with your VS installation since the error is coming from a VS function regarding the C# lang.

Did you installed VS2008 full installation options?

You may also try reseting the Hive and building/registering all the solution (End folder) for Lab5 in case some registration setting might be failing.

Thanks and have a great holiday!



Dec 24, 2009 at 10:18 PM


Re-installiong VS2008  solved the issue.

Rhank you.