我将值传递给 T4Scaffolding.Scaffolder 的前两个参数。但它不工作我例外。
这是 powershell 脚本文件。让我们给它一个名字Test.ps1
[T4Scaffolding.Scaffolder(Description = "Enter a description of Service here")][CmdletBinding()]
param(
[string]$ClassName,
[string]$Project,
[string]$CodeLanguage,
[string[]]$TemplateFolders,
[switch]$Force = $false
)
Write-Host "Class name is " $ClassName
Write-host "Project name is" $Project
然后我在包管理器控制台上运行它如下
PM> Scaffold Test Member ConsoleApplication1.Domain
它正确打印了我的 ClassName 但项目名称是在 nuget 包管理器控制台上选择的名称,而不是我提供的名称。
Class name is Member
Project name is ConsoleApplication1.Scaffolder
但例外的结果是
Class name is Member
Project name is ConsoleApplication1.Domain
现在的问题是如何将 ClassName 和 Project 作为参数传递?它只是将 ClassName 作为参数,但忽略第二个参数。
已编辑
也试过这个,但也没有用。
Scaffold Service -ClassName Member -Project ConsoleApplication1.Domain