Hi!

Thank you for the information and sorry for the delay!

We'll try to fix this problem in future versions of VisualSVN. Please
stay turned!



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 versions of
>> * Windows,
>> * Visual Studio,
>> * VisualSVN and
>> *T4Toolboxyou are using?
>>
>> The detailed reproduction script will be helpful too. Please keep in
>> mind that we're not familiar withT4Toolbox.
>>
>> > The error is:
>>
>> > Error 1 Running transformation: System.EntryPointNotFoundException:
>>
>> Most likely the problem is on theT4Toolbox'sside. Looks like they
>> call Visual Studio API from "another AppDomain" that is not allowed.
>> Could you please contactT4Toolbox'steam and ask them to check this?
>>
>> Looking forward for detailed configuration information and reproduction 
>> scripts.
>>
>> --
>> With best regards,
>> Danil Shopyrin
>> VisualSVN Team
>>
>> > Entry point was not found.
>> >   at VisualSVN.VS.Interop.NativeExtenderCallback.OnQueryEditFiles
>> > (UInt32 rgfQueryEdit, String[] rgpszMkDocuments, UInt32*
>> > pfEditVerdict, UInt32* prgfMoreInfo, Boolean* skipOriginal)
>> >   at VisualSVN.VS.Interop.NativeExtender.OnQueryEditFiles
>> > (NativeExtender* , UInt32 rgfQueryEdit, Int32 cFiles, UInt16**
>> > rgpszMkDocuments, UInt32* rgrgf,
>> > __MIDL___MIDL_itf_ivsqueryeditquerysave2_0000_0001* rgFileInfo,
>> > UInt32* pfEditVerdict, UInt32* prgfMoreInfo, Boolean* skipOriginal)
>> >   at EnvDTE.ProjectItems.AddFromFile(String FileName)
>> >   at
>> > Microsoft.VisualStudio.TextTemplating77FDAC4A39299DDBABC76D1B2340818A.GeneratedTextTransformation.TransformationContext.SaveOutputToFile
>> > (String fileName, String content) in c:\Program Files\T4 Toolbox
>> > \T4Toolbox\TransformationContext.tt:line 266
>> >   at
>> > Microsoft.VisualStudio.TextTemplating77FDAC4A39299DDBABC76D1B2340818A.GeneratedTextTransformation.Template.RenderToFile
>> > (String fileName) in c:\Program Files\T4 Toolbox\T4Toolbox
>> > \Template.tt:line 80
>> >   at
>> > Microsoft.VisualStudio.TextTemplating77FDAC4A39299DDBABC76D1B2340818A.GeneratedTextTransformation.ScaffoldingGenerator.GenerateDomainObjectAndTests
>> > () in c:\projects\Suvius\Flamingo\tools\CrudScaffolding
>> > \ScaffoldingGenerator.tt:line 106
>> >   at
>> > Microsoft.VisualStudio.TextTemplating77FDAC4A39299DDBABC76D1B2340818A.GeneratedTextTransformation.ScaffoldingGenerator.RunCore
>> > () in c:\projects\Suvius\Flamingo\tools\CrudScaffolding
>> > \ScaffoldingGenerator.tt:line 42
>> >   at
>> > Microsoft.VisualStudio.TextTemplating77FDAC4A39299DDBABC76D1B2340818A.GeneratedTextTransformation.Generator.Run
>> > () in c:\Program Files\T4 Toolbox\T4Toolbox\Generator.tt:line 68
>> >   at
>> > Microsoft.VisualStudio.TextTemplating77FDAC4A39299DDBABC76D1B2340818A.GeneratedTextTransformation.TransformText
>> > () in c:\projects\Suvius\Flamingo\tools\CrudScaffolding
>> > \ScaffoldingGeneratorCommand.tt:line 24 C:\projects\Suvius\Flamingo
>> > \tools\CrudScaffolding\ScaffoldingGeneratorCommand.tt 1 1
>>
>> > This seems very similar to the issues with ActiveWriter and VisualSVN
>> > described 
>> > here:http://groups.google.com/group/visualsvn/browse_thread/thread/ada83dc...
>>
>> > I've verified that uninstalling VisualSVN solved my problem but
>> > wouldn't mind keeping both it andT4Toolbox. I've tried going through
>> > theT4Toolboxcode but can't make any sense of it as I'm new to
>> > templating. But I'm using a project that has templates and need to
>> > uninstall VisualSVN every time I deal with it.
>



-- 
With best regards,
Olga Dolidze
VisualSVN Support

Reply via email to