diff --git a/CodeGenerator/CodeGenerator.cs b/CodeGenerator/CodeGenerator.cs
index 2b239a03..b094a63a 100644
--- a/CodeGenerator/CodeGenerator.cs
+++ b/CodeGenerator/CodeGenerator.cs
@@ -85,7 +85,7 @@ private void InitGenerators(GenerateRequest generateRequest)
DbDriver = InstantiateDriver();
// initialize file generators
- CsprojGen = new(outputDirectory, projectName, namespaceName, Options);
+ CsprojGen = new(DbDriver, outputDirectory, projectName, namespaceName);
QueriesGen = new(DbDriver, namespaceName);
ModelsGen = new(DbDriver, namespaceName);
UtilsGen = new(DbDriver, namespaceName);
diff --git a/CodeGenerator/Generators/CsprojGen.cs b/CodeGenerator/Generators/CsprojGen.cs
index f41319e9..345503db 100644
--- a/CodeGenerator/Generators/CsprojGen.cs
+++ b/CodeGenerator/Generators/CsprojGen.cs
@@ -1,20 +1,14 @@
using Google.Protobuf;
+using SqlcGenCsharp.Drivers;
using System;
+using System.Linq;
using File = Plugin.File;
namespace SqlcGenCsharp.Generators;
-internal class CsprojGen(string outputDirectory, string projectName, string namespaceName, Options options)
+internal class CsprojGen(DbDriver dbDriver, string outputDirectory, string projectName, string namespaceName)
{
- // TODO this logic needs to be moved to the Drivers project
- private const string DefaultDapperVersion = "2.1.66";
- private const string DefaultNpgsqlVersion = "8.0.6";
- private const string DefaultMysqlConnectorVersion = "2.4.0";
- private const string DefaultSqliteVersion = "9.0.0";
- private const string DefaultCsvHelperVersion = "33.0.1";
- private const string DefaultSystemTextJsonVersion = "9.0.6";
-
public File GenerateFile()
{
var csprojContents = GetFileContents();
@@ -27,7 +21,11 @@ public File GenerateFile()
private string GetFileContents()
{
- var optionalNullableProperty = options.DotnetFramework.IsDotnetCore() ? Environment.NewLine + " enable" : "";
+ var optionalNullableProperty = dbDriver.Options.DotnetFramework.IsDotnetCore() ? Environment.NewLine + " enable" : "";
+ var referenceItems = dbDriver.GetPackageReferences()
+ .Select(p => $""" """)
+ .JoinByNewLine();
+
return $"""