Git Product home page Git Product logo

t4.helper's Introduction

T4.Helper

Deprecated

This project is deprecated. The new project for Visual Studio 2017+ is T4.FileManger.

You can use the T4.FileManager via nuget if you run the following command in the Package Manager Console in Visual Studio:

PM> Install-Package T4.FileManager.VisualStudio

T4.TemplateFileManager

Usually it is sufficient when transforming a T4 Template “example.tt” results in a single output file “example.cs”. But there are situation in which one would like to have multiple different output files like:

  • Putting each generated data class into a single code file
  • Creating a server and a client component based on a common model
  • Distribute generated code to multiple projects within a solution

You can use the T4.TemplateFileManager via nuget if you run the following command in the Package Manager Console in Visual Studio:

PM> Install-Package T4.TemplateFileManager

Limitations

  • Only one instance of the T4.TemplateFileManager can be used per Template
  • Projects and folders, where you place the output files, will not created automatically

t4.helper's People

Contributors

pawelstroinski avatar renegadexx avatar ross-cz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

t4.helper's Issues

remove user files

The last commit adds user related files (.suo - soluton options and obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache) to repository. Remove them and add them to .gitignore file.

vs 2017

Hi will this work in 2017

Set-DefaultScaffolder : Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

Package installation is getting failed
Here is the error I am facing..
PM> Install-Package T4Scaffolding.Core.VS2017 -Version 1.0.1

Attempting to gather dependency information for package 'T4Scaffolding.Core.VS2017.1.0.1' with respect to project 'WebApplication18', targeting '.NETFramework,Version=v4.6.1'
Gathering dependency information took 1.96 sec
Attempting to resolve dependencies for package 'T4Scaffolding.Core.VS2017.1.0.1' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'T4Scaffolding.Core.VS2017.1.0.1'
Resolved actions to install package 'T4Scaffolding.Core.VS2017.1.0.1'
Retrieving package 'T4Scaffolding.Core.VS2017 1.0.1' from 'nuget.org'.
GET https://api.nuget.org/v3-flatcontainer/t4scaffolding.core.vs2017/1.0.1/t4scaffolding.core.vs2017.1.0.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/t4scaffolding.core.vs2017/1.0.1/t4scaffolding.core.vs2017.1.0.1.nupkg 1041ms
Installing T4Scaffolding.Core.VS2017 1.0.1.
Adding package 'T4Scaffolding.Core.VS2017.1.0.1' to folder 'C:\Users\Amit\Documents\Visual Studio 2017\Projects\WebApplication18\packages'
Added package 'T4Scaffolding.Core.VS2017.1.0.1' to folder 'C:\Users\Amit\Documents\Visual Studio 2017\Projects\WebApplication18\packages'
Added package 'T4Scaffolding.Core.VS2017.1.0.1' to 'packages.config'
Executing script file 'C:\Users\Amit\Documents\Visual Studio 2017\Projects\WebApplication18\packages\T4Scaffolding.Core.VS2017.1.0.1\tools\init.ps1'
Set-DefaultScaffolder : Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
At C:\Users\Amit\Documents\Visual Studio 2017\Projects\WebApplication18\packages\T4Scaffolding.Core.VS2017.1.0.1\tools\init.ps1:44 char:9

  •     Set-DefaultScaffolder -Name CustomTemplate -Scaffolder T4Scaf ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], COMException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

**## Set-DefaultScaffolder : Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
At C:\Users\Amit\Documents\Visual Studio 2017\Projects\WebApplication18\packages\T4Scaffolding.Core.VS2017.1.0.1\tools\init.ps1:45 char:9

  •     Set-DefaultScaffolder -Name CustomScaffolder -Scaffolder T4Sc ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], COMException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet**

Executing script file 'C:\Users\Amit\Documents\Visual Studio 2017\Projects\WebApplication18\packages\T4Scaffolding.Core.VS2017.1.0.1\tools\install.ps1'
Successfully installed 'T4Scaffolding.Core.VS2017 1.0.1' to WebApplication18
Executing nuget actions took 3.18 sec
Time Elapsed: 00:00:05.2765211

CanOverwriteExisting or CanOverrideExisting is not working

I am using it in VS2013 and VS2015. And in neither of these environments, these settings do anything.
I mean sometimes they do, but it's like 5% of the time (no rime or reason I can see). Also since I added override to overwrite it closes opened files (generated).
Also can you also clarify, what is the difference between the two?

T4.TemplateFileManager not working in Visual Studio 2015

Hi,

I am trying to output multiple files in VS2015, this is just not working, VS hangs completely with the "Visual Studio is busy" notification and will not recover.

It seems that everything hands when calling: fileManager.Process();

All the files do get generated as expected however VS just hangs.

Any ideas?

UPDATE:

Its seems the issue happens when files are added to a class library package project, even if I generate these files using a .tt in a separate project with the output to the class library package.

FindFolderByName issue, if folder is more than once in the same project

Is there any other way to find the correct position of my current folder, where the .tt files exists?
I have a large folder structure in my project. The method FindFolderByName just consider the First() Item in the same project, if there are more than one ProjectItems. But this must not be the correct folder:

projectA
  folder1
    folder1-1
  folder2
    folder1-1
      template.tt

StartNewFile("AdditionalsFile.cs"), "projectA", "folder1-1");

With this constellation the additional file will be generated in the first folder1-1 and not in the folder where the template is.

The method FindFolderByName should be more precise to find the correct folder. Maybe with a more specific folderName parameter in the StartNewFile method.

Project still maintained

Will this project still be maintained? Last submits were 2 years ago, pull requests open since march...

Performance Issue

When we are using the CreateNew function with repeatition for various projects as source then the code is performing badly. The reason is because in such case it will get the project details repeatedly without caching it.

There are other reasons though and will be posting them too in upcoming days.

Specifying BuildAction does not work

I am trying to generate C# code for a separate project using a T4 template that should not be built in the current project and should therefore be included as static content. My template uses

manager.StartNewFile(endpointClassName + ".cs", fileProperties: new FileProperties()
{
    BuildAction = BuildAction.Content
});

to start a new file. However, the VS project file properties list Compile as the selected build action and the project file's XML contains <Compile> tags.

How is it possible to force TemplateFileManager into setting the build action properly? It obviously ignores the fileProperties parameter which I consider a bug.

Reverse order?

What is the functional purpose for the line of code files.Reverse(); that reverses the order in which files are created? It's minor, but seems odd that, because of this, the log lists each file in reverse alphabetical order.

NuGet Package is not updated

Hello,

I've seen that your latest commit was on Apr 18, 2014, however the latest version of the NuGet package was on Saturday, August 11 2012.

Please, could you update the NuGet Package? Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.