Reputation: 1798
I'm trying to port a NET Framework 4.7.2 class library project to NET Core 3.1 (or 5.0). The project uses a database through the System.Data.Odbc
Nuget package. The problem is that the Visual Studio Database Designer generates code that references OleDb and Properties (global::...Settings) that cause reference errors during compilation.
Here are bits of code generated by the designer for OleDb and Properties:
public partial class ColorsTableAdapter : global::System.ComponentModel.Component {
private global::System.Data.OleDb.OleDbDataAdapter _adapter;
private global::System.Data.OleDb.OleDbConnection _connection;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitConnection() {
this._connection = new global::System.Data.Odbc.OdbcConnection();
this._connection.ConnectionString = global::NewDatabase.Properties.Settings.Default.NewConnectionString;
}
I am new to NET Core so maybe I have set up Properties/Settings in the project somehow? (I have not set up any connection strings, so maybe it's referencing old strings somewhere?)
But I'm using Odbc everywhere in my code, so I don't know why the Designer is generating OleDb code. I deleted the designer.cs file to force a regeneration, but the regenerated file regenerates the bad code. In the end I added the System.Data.OleDb
package to make the compilation errors go away, but it doesn't make sense to me.
How can I fix the two problems? All I can think of is to delete the entire DataSet.xsd
file and start over again, but that seems like a low-probability action. Thank you
Upvotes: 0
Views: 507