First of all, I'm working with Visual Studio 2015 (and can't upgrade VS version) and using a MySQL library. My using directives are
using System;
using System.Data;
using MySql.Data.MySqlClient;
And I'm trying to connect with a MySQL database with
MySqlConnection ms = new MySqlConnection(ConnectionData.ToString());
ms.Open();
The name of the function Open() is autocompleted ok, and I know it works fine on another projects I have been working on, but now I get this compiler error when trying to invoke the Open() function:
Must add an assembly reference 'System.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
I think my System.Data library is quite old, but I can't find a System.Data.dll file in my project (That way I could just replace it), anyone know how to just upgrade that library?
Related
I am trying to add SpreadSheetLight to a new Dnn v9.10.2 project running on Windows Server 2019, but I get a runtime error saying
CS0433: The type 'Image' exists in both 'System.Drawing.Common,
Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and
'System.Drawing, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'
when I copy the dlls into the bin folder. I have a file that was using System.Drawing, but it was using the full namespace in it's references. I tried updating those to System.Drawing.Common, but it instead throws the error
CS0234: The type or namespace name 'Common' does not exist in the
namespace 'System.Drawing' (are you missing an assembly reference?)
Commenting out the lines of code using System.Drawing resolved the runtime error, but ultimately when trying a simple test of just opening and closing a blank workbook it throws the exception
System.PlatformNotSupportedException: System.Drawing is not supported
on this platform.
I haven't been able to find much on how to fix this so any help would be appreciated.
Upon first glance it seems that this library is a .NET 3.5 library and DNN Platform 9.10.2 is .NET Framework 4.7.2 you are most likely hitting a compatibility issue with changes in .NET 4.7.
It looks like the source for SpereadSheetLight is available, you could try to recompile it for .NET 4.7.2 and see if you can clear the issue.
I keep getting this exception when I start my program.
System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=8.0.13.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'. The parameter is incorrect.
Somewhere I read it could be caused by a corrupted package: I have tried to reinstall the NuGet package, but it's still not working.
NOTE: I'm not using Visual Studio, I'm coding a .NET Core class library using Jetbrains Riders on a Linux computer.
Try using an older version of MySql. Use the NuGet-Manager and download version 6.8.8 of MySql.Data, always worked for me.
I'm building a simple web hook function that does some work against Azure Resources using the C# Resource Manager API. The build fails with:
.nuget\packages\microsoft.net.sdk.functions\1.0.2\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets(31,5): error : Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
I've checked and everything is pulling Newtonsoft.Json 9.0.1. I'm guessing it's due to some mismatch in my Nuget packages but not sure how to dig in?
I have:
Microsoft.Azure.Management.ResourceManager 1.6.0-preview
Microsoft.NET.Sdk.Functions 1.0.2
Microsoft.Rest.ClientRuntime.Azure.Authentication 2.3.1
using System.Collections.Generic;
using System.Net;
using Newtonsoft.Json;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.Management.ResourceManager;
using Microsoft.Azure.Management.ResourceManager.Models;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Newtonsoft.Json.Linq;
using Microsoft.Rest.Azure.Authentication;
Using VS2017 15.3.3
It all came down to the preview Resource Manager package.
Microsoft.Azure.Management.ResourceManager 1.6.0-preview
Since this is Open Source I went to the GitHub project and checked it out. Essentially came down to it requiring a specific version of NewtonSoft. I fixed my problem by placing the code using the resource manager API into one assembly and just used that. This now works fine in Azure Functions.
In short, look at the dependencies, isolate them in an assembly then include that in your project.
I am developing a solution that will interface with the SDK of a 3rd party application and ultimately create a dataset to migrate data into a destination database on our SQL Server 2014 instance. This interface is via a SQL Server CLR Stored procedure. the following references have been used in creating the CLR assembly on the C# side:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using (3rd party SDK);
using System.Dynamic;
The code builds correctly and all. However, when I attempt to create an assembly using the CREATE ASSEMBLY statement I get the following error:
Assembly 'MyAssembly' references assembly 'system.drawing, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
Going further, if I attempt to create an unsafe assembly based on the apparently missing reference, system.drawing (keep in mind I do have trustworthy set to true in the target database), I get the following error:
CREATE ASSEMBLY for assembly 'System.Drawing' failed because assembly 'System.Drawing' failed verification. Check if the referenced assemblies are up-to-date and trusted (for external_access or unsafe) to execute in the database. CLR Verifier error messages if any will follow this message
[ : System.Drawing.Image::Finalize][mdToken=0x600000d][offset 0x00000000] Code size is zero. (etc, etc. same error repeating on different methods in system.drawing)
I already have the .NET frameworks matching between the solution and the target SQL Server database matching to v4.0. I honestly am at a loss here, and this seems soo much harder than it should be. I'm not even directly referencing System.Drawing, yet I need it for some odd reason.
While it might not always behave as expected, you should be able to load System.Drawing into SQL Server. You will need to set the Database to TRUSTWORTHY ON (which it seems that you have), and you need to mark the Assembly as UNSAFE in the CREATE ASSEMBLY statement (i.e. use the WITH PERMISSION_SET = UNSAFE clause).
If you still get an error, make sure you are loading the actual System.Drawing DLL and not one of the reference Assemblies, and make sure you grab the correct 32-bit or 64-bit version.
For CLR version 4.0 (which is used by SQL Server 2012 and newer), the assembly path should be one of following two options, depending on whether you need the 32-bit or 64-bit version:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Drawing.dll
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Drawing.dll
Also, you don't need to worry about the .NET Framework version as long as you are using one that is bound to the proper CLR version, which is 4.0. Meaning, you could just as well be using .NET Framework version 4.5.2 or 4.6, so long as the target server has been updated to that Framework version.
i'm begginer in xamarin, but i have to write app. I have to connect to MySQL and update some data. I have written code, whitch works in vs 2013 express, but in Xamarin i have error:
The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. (CS0012)
What i can do to repair it? - change target framework?
i'm using Mysql.Data.dll
pls for quick answer :)
It says you need to add refference to System.Data. It is located in Xamarin Base Class Libraries. Use right click on Refferences "folder" in Xamarin Studio to add refference.