& # 39; DynamicTransform& # 39;在T4Scaffolding生成CustomScaffol

本文关键字:CustomScaffol 生成 DynamicTransform T4Scaffolding | 更新日期: 2023-09-27 18:06:22

我正试图使用T4Scaffolding为我当前的项目,但它在开始时失败。

我一步一步地做同样的过程在这个链接,教如何使用T4Scaffolding的基本控制台应用程序。

我做的步骤

1-我创建了一个新的控制台应用程序(。NET 4.0)

2-我使用包管理器控制台(install-package t4scaffolding)成功安装了t4scaffold

3-我尝试使用像

这样的包管理器控制台创建一个演示自定义模板

Scaffold CustomScaffolder T4Demo

则在

下面抛出异常
Add-ProjectItemViaTemplate : c:'Users'ryu'Desktop'SpiderWeb'ConsoleApplication2'packages'T4Scaffolding.Core.1.0.0'tools'CustomScaffolder'DefaultPs1Script.ps1.t4(1,48) : error CS0246: Com
piling transformation: The type or namespace name 'DynamicTransform' could not be found (are you missing a using directive or an assembly reference?)
At C:'Users'ryu'Desktop'SpiderWeb'ConsoleApplication2'packages'T4Scaffolding.Core.1.0.0'tools'CustomScaffolder'T4Scaffolding.CustomScaffolder.ps1:15 char:1
+ Add-ProjectItemViaTemplate $outputPath -Template DefaultPs1Script -Model @{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-ProjectItemViaTemplate], Exception
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet
Add-ProjectItemViaTemplate : c:'Users'ryu'Desktop'SpiderWeb'ConsoleApplication2'packages'T4Scaffolding.Core.1.0.0'tools'CustomScaffolder'DefaultT4Template.cs.t4(1,48) : error CS0246: Com
piling transformation: The type or namespace name 'DynamicTransform' could not be found (are you missing a using directive or an assembly reference?)
At C:'Users'ryu'Desktop'SpiderWeb'ConsoleApplication2'packages'T4Scaffolding.Core.1.0.0'tools'CustomScaffolder'T4Scaffolding.CustomScaffolder.ps1:22 char:1
+ Add-ProjectItemViaTemplate $outputPath -Template DefaultT4Template -Model @{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-ProjectItemViaTemplate], Exception
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.AddProjectItemViaTemplateCmdlet

我做错了什么

& # 39; DynamicTransform& # 39;在T4Scaffolding生成CustomScaffol

在我将我的windows区域设置从我的母语更改为美国后,问题就消失了。不要忘记重新启动Visual Studio。

真是个烦人的问题