I had a chance to test this and I'm no longer getting any errors. Seems to work! Thanks.
On Mar 2, 4:12 am, VisualSVN Support <supp...@visualsvn.com> wrote: > Hi Kyle! > > We're trying to enable VisualSVN to support T4Tollbox template. Please > try this special development > build:http://www.visualsvn.com/files/VisualSVN-1.6.2.18026.msi > > Note that this is not an official release and it's intended for > testing of new features only. > > Please let us know if you will find any problems with that build. > > Looking forward for your feedback. > > On Mon, Feb 2, 2009 at 5:25 PM, Kyle Baley <kyle.ba...@gmail.com> wrote: > > > Danil, > > > Apologies for not checking in. Thought I was getting e-mail alerts on > > this. > > > Windows 2008 Server (running as a desktop) > > Visual Studio 2008 (version 9.0.30729.1 SP) > > Visual SVN 1.6.1 > > T4Toolbox 9.1.20.1 (current as of today) > > > The reproduction scripts will be hard to explain as I didn't build > > them myself. I think the three templates at the bottom should do it > > but basically, any template that calls RenderToFile seems to start the > > whole thing. > > > I mentioned the AppDomain problem in the T4Toolbox discussion board. > > Both the creator and myself are confused, though he seems to have a > > better grasp of the problem. Here's an excerpt of his comment: > > > "I followed the ActiveWriter thread and don't understand how their > > patch can work. How can the EnvDTE code executing on the thread pool > > in a temporary appdomain be marshalled to the default appdomain? The > > EnvDTE code doesn't have this problem with Visual SourceSafe and Team > > Foundation Server source control providers." > > > Here is the template that launches the template generation: > > > -------------------------------- > > > <#@ template language="C#" hostspecific="True" debug="True" #> > > <#@ import namespace="System.Collections.Specialized" #> > > <#@ output extension="txt" #> > > <#@ include file="T4Toolbox.tt" #> > > <#@ include file="ScaffoldingGenerator.tt" #> > > > <# > > /////////////////////////////////////////////////// > > // Set your domain object details below and simply save this file to > > auto-generate the scaffolding > > > // Domain name should be PascalCaseSingular > > string domainObjectName = "Artist"; > > > // Properties should be name/value pairs representing the property- > > name/data-type of the properties; property names should be PascalCase > > NameValueCollection properties = new NameValueCollection(); > > properties.Add("Title", "string"); > > properties.Add("Artist", "string"); > > properties.Add("Album", "string"); > > properties.Add("Genre", "string"); > > > /////////////////////////////////////////////////// > > > ScaffoldingGenerator generator = new ScaffoldingGenerator( > > @"e:\code\Suvius\Flamingo\", "Flamingo", domainObjectName, > > properties); > > > generator.Run(); > > #> > > > -------------------------------- > > > Here is the generator template: > > > <#@ include file="Pluralizer.tt" #> > > <#@ include file="ScaffoldingEnums.tt" #> > > <#@ include file="./Templates/BaseTemplate.tt" #> > > <#@ include file="./Templates/Controllers/ControllerTemplate.tt" #> > > <#@ include file="./Templates/Core/DomainObjectTemplate.tt" #> > > <#@ include file="./Templates/Data/NHibernateMaps/ClassMapTemplate.tt" > > #> > > <#@ include file="./Templates/Tests/Controllers/ > > ControllerTestsTemplate.tt" #> > > <#@ include file="./Templates/Tests/Core/DomainObjectTestsTemplate.tt" > > #> > > <#@ include file="./Templates/Web/Views/DomainObjectFormTemplate.tt" > > #> > > <#@ include file="./Templates/Web/Views/CreateTemplate.tt" #> > > <#@ include file="./Templates/Web/Views/EditTemplate.tt" #> > > <#@ include file="./Templates/Web/Views/IndexTemplate.tt" #> > > <#@ include file="./Templates/Web/Views/IndexCodeBehindTemplate.tt" #> > > <#@ include file="./Templates/Web/Views/IndexDesignerTemplate.tt" #> > > <#@ include file="./Templates/Web/Views/ShowTemplate.tt" #> > > <#@ include file="./Templates/Web/Views/GeneralCodeBehindTemplate.tt" > > #> > > <#@ include file="./Templates/Web/Views/GeneralDesignerTemplate.tt" #> > > <#@ import namespace="System.IO" #> > > > <#+ > > public class ScaffoldingGenerator : Generator > > { > > public ScaffoldingGenerator(string projectRootPath, string > > solutionName, string domainObjectName, NameValueCollection properties) > > : this(projectRootPath, solutionName, domainObjectName, > > properties, > > null) { } > > > public ScaffoldingGenerator(string projectRootPath, string > > solutionName, string domainObjectName, NameValueCollection properties, > > ArtifactToGenerate[] artifactsToGenerate) { > > this.solutionRootFolder = projectRootPath + "app\\"; > > this.scaffoldingOutputFolder = projectRootPath + "tools\ > > \CrudScaffolding\\"; > > this.testsRootFolder = projectRootPath + "tests\\"; > > this.logsPath = projectRootPath + "logs\\"; > > > this.solutionName = solutionName; > > this.domainObjectName = domainObjectName; > > this.properties = properties; > > this.artifactsToGenerate = artifactsToGenerate; > > } > > > protected override void RunCore() { > > // Get rid of the existing generation log > > File.Delete(logsPath + LOG_FILE_NAME); > > > GenerateClassMap(); > > } > > > private void GenerateClassMap() { > > string fileName = domainObjectName + "Map.cs"; > > string targetPath = solutionRootFolder + solutionName + > > ".Data\ > > \NHibernateMaps\\"; > > > if (DidRequestToGenerate(ArtifactToGenerate.ClassMap)) { > > if (! Directory.Exists(targetPath)) { > > Directory.CreateDirectory(targetPath); > > > Log("Added directory " + targetPath); > > } > > > if (! File.Exists(targetPath + fileName)) { > > ClassMapTemplate classMapTemplate = > > new ClassMapTemplate(solutionName, > > domainObjectName, properties); > > classMapTemplate.RenderToFile(fileName); > > > File.Move(scaffoldingOutputFolder + > > fileName, targetPath + > > fileName); > > > Log("Added file " + targetPath + fileName); > > } > > else { > > Log("File already exists " + targetPath + > > fileName); > > } > > } > > else { > > Log("Skipped generation of class map"); > > } > > } > > > private string DomainObjectNamePlural { > > get { > > return Pluralizer.ToPlural(domainObjectName); > > } > > } > > > private void Log(string message) { > > StreamWriter streamWriter = File.AppendText(logsPath + > > LOG_FILE_NAME); > > streamWriter.WriteLine(DateTime.Now.ToLongTimeString() + > > "\t" + > > message); > > streamWriter.Close(); > > } > > > private readonly string logsPath; > > private readonly string testsRootFolder; > > private readonly string scaffoldingOutputFolder; > > private readonly string solutionRootFolder; > > private readonly ArtifactToGenerate[] artifactsToGenerate; > > private readonly string solutionName; > > private readonly string domainObjectName; > > private readonly NameValueCollection properties; > > private const string LOG_FILE_NAME = "CrudScaffolding.log"; > > } > > #> > > > ------------------------------ > > And here is the actual template that is used to generate the class: > > > <#@ import namespace="System.Collections" #> > > > <#+ > > public class ClassMapTemplate : BaseTemplate > > { > > public ClassMapTemplate(string solutionName, string domainObjectName, > > NameValueCollection properties) > > : base(solutionName, domainObjectName, properties) { } > > > protected override void RenderCore() > > { > > #> > > using <#= SolutionName #>.Core; > > using FluentNHibernate; > > using FluentNHibernate.Mapping; > > using SharpArch.Data.NHibernate.FluentNHibernate; > > > namespace <#= SolutionName #>.Data.NHibernateMappings > > { > > public class <#= DomainObjectName #>Map : ClassMap<<#= > > DomainObjectName #>>, IMapGenerator > > { > > public <#= DomainObjectName #>Map() { > > WithTable("<#= DomainObjectNamePlural #>"); > > > Id(x => x.ID) > > .WithUnsavedValue(0) > > .GeneratedBy.Identity(); > > > <#+ > > PushIndent("\t\t\t"); > > > foreach (string propertyName in Properties.AllKeys ) > > { > > WriteLine("Map(x => x." + propertyName + > > ");"); > > } > > > PopIndent(); > > #> > > } > > > #region IMapGenerator Members > > > public System.Xml.XmlDocument Generate() { > > return CreateMapping(new MappingVisitor()); > > } > > > #endregion > > } > > } > > <#+ > > } > > } > > #> > > > On Jan 9, 4:51 am, "VisualSVN Team" <supp...@visualsvn.com> wrote: > >> Hello! > > >> Thanks for your interest in VisualSVN! > > >> > I'm getting a VisualSVN error when I try to run a T4 template that > >> > usesT4Toolbox(www.codeplex.com/T4Toolbox). > > >> Could you please provide us with detailed information about your > >> configuration? What > > ... > > read more »