I’m trying to use the PetaPoco T4 template (from NuGet, version 4.0.3) but when I try and run the template I get the following error:
Running transformation: System.ArgumentException: URI formats are not
supported.
at System.IO.Path.NormalizePath(String path, Boolean
fullCheck, Int32 maxPathLength) at
System.IO.Path.GetFullPathInternal(String path) at
System.IO.FileInfo.Init(String fileName, Boolean checkHost) at
System.IO.FileInfo..ctor(String fileName) at
Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.GetProjectPath()
at
Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.GetConfigPath()
at
Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.GetConnectionString(String&
connectionStringName, String& providerName) at
Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.InitConnectionString()
at
Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.LoadTables()
at
Microsoft.VisualStudio.TextTemplating.GeneratedTextTransformation.TransformText()
in Database.tt
I’m not sure what I’m doing wrong here.. the connection string is specified and has been set correctly in Database.tt. Are there some other requirements for using this T4 template other than a correct connection string?
My Database.tt settings look like this:
// Settings
ConnectionStringName = "ConnectionString";
Namespace = "TVPPData";
RepoName = "MyContext";
GenerateOperations = true;
GeneratePocos = true;
GenerateCommon = true;
ClassPrefix = "";
ClassSuffix = "";
TrackModifiedColumns = true;
Thanks!
I’ve figured it out myself:
It turns out the Petapoco T4 template doesn’t work with website projects which have been added to the solution using their URL or IIS entry. I’ve now re-added the project as a filesystem project and now it works fine.