1

我正在尝试使用 PetaPoco T4 模板(来自 NuGet,版本 4.0.3),但是当我尝试运行模板时出现以下错误:

运行转换:System.ArgumentException:不支持 URI 格式。
在 System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength) 在 System.IO.Path.GetFullPathInternal(String path) 在 System.IO.FileInfo.Init(String fileName, Boolean checkHost) 在 System.IO。 FileInfo..ctor(String fileName) 在 Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.GetProjectPath() 在 Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.GetConfigPath() 在 Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.GetConnectionString(String& connectionStringName, String& providerName) 在Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.InitConnectionString() 在 Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.LoadTables() 在 Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation。变换文本()

在数据库.tt

我不确定我在这里做错了什么..连接字符串已指定并且已在 Database.tt 中正确设置。除了正确的连接字符串之外,使用此 T4 模板是否还有其他要求?

我的 Database.tt 设置如下所示:

// Settings
ConnectionStringName = "ConnectionString";
Namespace = "TVPPData";
RepoName = "MyContext";
GenerateOperations = true;
GeneratePocos = true;
GenerateCommon = true;
ClassPrefix = "";
ClassSuffix = "";
TrackModifiedColumns = true;

谢谢!

4

1 回答 1

2

我自己想通了:

事实证明,Petapoco T4 模板不适用于使用其 URL 或 IIS 条目添加到解决方案中的网站项目。我现在已经将该项目重新添加为文件系统项目,现在它工作正常。

于 2012-11-14T11:29:20.820 回答