Problem Migrate Templates from 2.6 to 3.0

Posts   
 
    
Posts: 56
Joined: 08-Jun-2010
# Posted on: 30-Jun-2010 17:26:29   

Hi

Due to the lack of llblgen 3.0 documentation I developed a set of custom templates in version 2.6. I have them working and have been trying to migrate them to v3.

My project uses a custom helper class CodeGenerationHelper.dll with some shared helper methods inside. In 2.6 this was deployed in the folder ....\LLBLGen Pro v2.6\ReferencedAssemblies and referenced from my templates using the <$ $> tags.

For V3 I've changed my helper class to target framework 3.5, changed the referenced assemblies to the llblgen v3.0 ones and I've changed the deployment folder to "\LLBLGen Pro v3.0\Frameworks\LLBLGen Pro\RuntimeLibraries\Net3.5\" and I've updated my <$ $> tags accordingly.

When I run the code generation I get the following error:

"Could not load file or assembly 'CodeGenerationHelper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."

(stack trace at end of this post)

If I run the generator again (without any changes) I get a different message:

Exception message:

Exception type: GeneratorAbortException Compilation of templates threw errors:

Error CS0042, at line: 0, pos: 0: Unexpected error creating debug information file 'c:\Users\brettb\AppData\Local\Temp\2D18D138-1DD2-467E-86CC-4838250611AE\LptTemplateAssembly.PDB' -- 'c:\Users\brettb\AppData\Local\Temp\2D18D138-1DD2-467E-86CC-4838250611AE\LptTemplateAssembly.pdb: The process cannot access the file because it is being used by another process.

I thought it might be the dependencies so I've copied all the referenced assemblies into the same folder but this makes no difference.

Any Ideas ?

Thanks ~Brett


-----[Core exception]-------------------- at voda_dto.__ScriptCode() at voda_dto.___RUN(IGenerator executingGenerator, Dictionary2 parameters, StreamWriter outputWriter, Object activeObject) in c:\Users\brettb\AppData\Local\Temp\2D18D138-1DD2-467E-86CC-4838250611AE\templateClassesSource.cs:line 182 at SD.LLBLGen.Pro.LptParser.DotNetTemplateEngine.CallTemplateEmitter[TElement](Assembly compiledTemplatesAssembly, String templateID, Dictionary2 parameters, StreamWriter outputWriter, TElement currentElement) at SD.LLBLGen.Pro.GeneratorCore.CodeGenerationEngineBase.EmitOutputToFile[TElement](TElement currentElement, String destinationFilename, Boolean failWhenExistent, Assembly compiledTemplatesAssembly, String templateID, Dictionary2 parameters, Boolean isPartOfSet, String outputDescription) at SD.LLBLGen.Pro.GeneratorCore.CodeGenerationEngineBase.EmitOutputForElements[TElement](String fullPath, String filenameFormat, Boolean failWhenExistent, String templateID, Assembly compiledTemplatesAssembly, Dictionary2 parameters, ICollection1 elementsToTraverse, EmitType emitTypeUsed, Func2 nameProducerFunc, Func2 fullNameProducerFunc, Func2 elementTypeNameProducerFunc) at SD.LLBLGen.Pro.GeneratorCore.CodeGenerationEngineBase.EmitOutput(Dictionary2 parameters, String fullPath, String templateID, Assembly compiledTemplatesAssembly, EmitType emitTypeToPerform, String filenameFormat, Boolean failWhenExistent) at SD.LLBLGen.Pro.LptParser.DotNetTemplateEngine.Perform(IGenerator executingGenerator, ITask taskDefinition, Dictionary2 parameters) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.Task.PerformElement(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.TaskGroupElement.Perform(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.TaskGroup.PerformElement(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.TaskGroupElement.Perform(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.TaskGroup.PerformElement(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.TaskGroupElement.Perform(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.TaskGroup.PerformElement(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.TaskGroupElement.Perform(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.TaskGroup.PerformElement(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks.TaskGroupElement.Perform(IGenerator executingGenerator, LogNode parentNode) at SD.LLBLGen.Pro.GeneratorCore.Generator.RunTasks(String rootNameSpaceToUse, String destinationRootFolder, String groupName) at SD.LLBLGen.Pro.GeneratorCore.Generator.Start(ITaskGroup tasksToExecute, ApplicationConfiguration configurationSettings, Language languageToUse, Platform platformToUse, List1 templateBindingsToUse, String templateGroupToUse, String rootNameSpaceToUse, String destinationRootFolder, Project projectDefinition, CodeGenerationCycleOutputType outputType) at SD.LLBLGen.Pro.GeneratorCore.Generator.Start(ITaskGroup tasksToExecute, CodeGenerationCyclePreferences preferences, ApplicationConfiguration configurationSettings, Project projectDefinition) at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformRunCodeGenerationCycleAction(ITaskGroup toExecute, CodeGenerationCyclePreferences codeGenerationCyclePreferences, HashSet1 entitiesToUse, HashSet1 spCallsToUse, HashSet1 typedViewsToUse, HashSet1 typedListsToUse, HashSet1 valueTypesToUse, LogNode& tasksResultLog)

Walaa avatar
Walaa
Support Team
Posts: 14986
Joined: 21-Aug-2005
# Posted on: 30-Jun-2010 17:48:39   

I've changed the deployment folder to "\LLBLGen Pro v3.0\Frameworks\LLBLGen Pro\RuntimeLibraries\Net3.5\"

From v.3.0 SDK Docs:

A referenced assembly has to be loadable at runtime when the template code is ran. To accomplish this, the referenced assembly has to be in the GAC or has to be placed in a folder which is added to the LLBLGenPro.exe.config's probing tag. If the LLBLGenPro.exe.config file's probing tag doesn't already contain 'ReferencedAssemblies', add it manually. This will make sure the CLR can find the assembly

Posts: 56
Joined: 08-Jun-2010
# Posted on: 01-Jul-2010 11:18:06   

Great! my templates are working again now.

The cause of the confusion is that llblgen 3.0 doesn't create the ReferencedAssemblies folder any more. It does reference it the .config file as you mentioned so creating it manually sorted my problem.

Thanks for the help :-)

~Brett

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39767
Joined: 17-Aug-2003
# Posted on: 01-Jul-2010 12:39:56   

Good point. We'll add it to the installer to create that folder and document it better in the SDK docs.

Frans Bouma | Lead developer LLBLGen Pro