I'm using ImageResizing.Net within a class library as part of a back-end which requires bypassing Web.Config/App.Config by installing plugins in code like so:
ImageResizer.Configuration.Config.Current.Plugins.Install(new ImageResizer.Plugins.SimpleFilters.SimpleFilters());
ImageResizer.Configuration.Config.Current.Plugins.Install(new ImageResizer.Plugins.AdvancedFilters.AdvancedFilters());
I've verified that plugins are loaded within:
ImageResizer.Configuration.Config.Current.Plugins
I'm getting the following error when imageJob.Build(); is called:
Could not load file or assembly 'AForge.Imaging, Version=2.2.5.0, Culture=neutral, PublicKeyToken=ba8ddea9676ca48b' or one of its dependencies. The system cannot find the file specified.
Hoping this could be solved by referencing the libraries directly I've added the following using statements to the top of the class that uses ImageResizer:
using AForge;
using AForge.Imaging;
using AForge.Imaging.Filters;
using AForge.Imaging.ColorReduction;
using AForge.Imaging.ComplexFilters;
using AForge.Imaging.Textures;
Am still getting the same error. I've verified that the AForge references exist in my project, are the correct version and have "Copy Local" set to "True". These references were part of the dependencies that were automatically installed with the Nuget Packages for ImageResizing & the associated plugins.
UPDATE
I've decided to move the image processing over to a web api since the library was not designed for this scenario. This is called out by the author of the library in the comments of this S.O. question . I will mark this as the answer.
I've decided to move the image processing over to a web api since the library was not designed for this scenario. This is called out by the author of the library in the comments of this S.O. question
Related
When making a project in WPF C# (.NET 5.0), I wanted to use data from my database. I have a Microsoft Access file (2000-2003 compatible version, *.mdb), which I needed to use for my project.
After I added new source
Add > new Item... > Data > DataSet and specified properly the database (the connection was tested successful), file DataSetProj.xsd has been created.
However, when I tried running the code, the following error occurred:
Error CS1069: The type name 'OleDbDataAdapter' could not be found in the namespace 'System.Data.OleDb'. This type has been forwarded to assembly 'System.Data.OleDb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly.
When clicking the CS1069 hyperlink, this site opened (unfortunately, no specifics on the error were provided).
Trying to fix the error myself, I found System.Data.OleDb namespace documentation. Here's my interesting observation: The code automatically generated by DataSetProj.Designer.cs file had classes (supposedly defined in the namespace), like OleDbConnection, or OleDbDataAdapter. Funnily enough, this namespace mentions these classes, but it appears they are not part of the namespace (although this is official MS documentation). When I enter documentation of either of the classes, they are included in the System.Data.Ole.Db namespace. This is weird and super unclear (at least for me, junior dev) documentation.
I tried switching to .NET 4.8 Framework, use EF Core Power Tools by ErikEJ (unfortunately it doesn't work with Access *.mdb file). I could not find the answer to this problem anywhere, although it seems like many people would have such an issue.
How do I make it work?
I noticed that the namespace System.Data.OleDb referenced in OleDbDataAdapter class is located in System.Data.OleDb.dll Assembly. When googled the name of the assembly, I found this link. After downloading and installing the assembly (using NuGet Package Manager), the error was resolved.
I hope that other people having the same issue will have it fixed upon visiting this post.
System.Data.OleDb is not part of .Net 5 but is available as part of the .Net Platform Extensions. See below link for more details on .Net Platform Extensions:
What are .NET Platform Extensions on learn.microsoft.com?
If ok with exclusively targeting Microsoft Windows Platform, you can consider installing the windows compatibility pack which includes the OleDb dll as well (below link) or consider rewriting your code to avoid OleDb (ODCB or ADO maybe?):
https://www.nuget.org/packages/Microsoft.Windows.Compatibility
I have an iOS/Android Xamarin project that share a PCL project.
I have added a web reference to the PCL via ASMX as per Xamarin's Tutorial. The tutorial doesn't say how to get to the "Add Web Reference" window, but we found it by right-clicking our PCL project and going to Add->Web Reference.
On adding the web reference I get a roughly 500 line Reference.cs file that is added to the PCL.
However, on compilation, either iOS or Android, I am given several of these errors:
Reference.cs(74,74): Error CS0234: The type or namespace name IExtensibleDataObject' does not exist in the namespaceSystem.Runtime.Serialization'. Are you missing an assembly reference? (CS0234) (MyProject)
It is clear that I need to add the System.Runtime.Serialization assembly reference. However I cannot figure out how to do this and I have spent hours looking for documentation or any relevant solution. Most posts questions appear tangental at best.
This forum post references this issue, but give no solution other than it was supposedly “fixed” three years ago.
Now the aforementioned tutorial references an "Add References…" dialog box for adding the System.Web.Services.dll if you use "Add files" to add the proxy. However, I cannot find this dialog anywhere in the IDE.
I did find "Edit References" when right-clicking on references. This produced a window with these tabs:
Guessing that the assembly needs to be added here I search for it, but find nothing. Apparently there is no way to add assemblies that are packaged with the IDE, you're expected to "just know" where to find them. Searching for documentation proves fruitless.
Via one of the sample project, I was able to locate the .dll file at /Library/Frameworks/Mono.framework/Versions/4.4.2/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Serialization.dll and manually add it via the .NET Assembly tab.
A colleague tried adding the reference via NuGet as well.
Unfortunately the compile errors remain after attempting either approach.
Also, of note, it appears that the ToDoASMX example project nor the folder containing the System.Runtime.Serialization.dll have any references to the System.Web.Services.dll that the tutorial mentions.
I believe these docs are referring to using them in Xamarin.iOS and Xamarin.Android(At least for the .asmx docs). You can get to System.Runtime.Serializationvia right clicking References in your Xamarin.iOS/ Xamarin.Android project, Going to Edit References, then going to the All tab which it should be listed under the BCL (Base Class LIbrary). You may need to go the route of using an Interface based pattern within your PCL to call the respective native web service instead. You could also try wrapping your .asmx into a REST service and using HttpClient as well.
Seeing this sample project(https://developer.xamarin.com/samples/xamarin-forms/WebServices/TodoASMX/) shows the Interface based pattern described above using ISoapService in the PCL and implementing in the native projects. You will see each project (Droid/iOS) have the Web Reference in them. The PCL is purely invoking the code.
It's more of a limitation of using .asmx given the framework built around them. Using WCF or REST have better options for consuming directly from a PCL. However note that PCLs are going to be replaced by NetStandard library flavor.
I'm looking at incorporating the new Google Apps Script Execution API into an existing C# plugin i have already working. I am following the .NET quickstart guide provided as a console application (which i have gotten working without problem).
When porting the code from that into my plugin it will also fail at runtime at the first instance of:
UserCredential credential;
which I slimmed down the code so far to just that line which fails giving:
"Could not load file or assembly 'Google.Apis.Auth, Version=1.9.2.27817, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The system cannot find the file specified."
The file is properly referenced (having installed via nuget).
C# is not my normal field and perhaps i'm missing something in the subtlety of it working in a Console App.
What gives?
There was a time when console apps defaulted to using the client profile rather than the full .Net framework. Check the properties of the project on the Application tab and make sure the target framework doesn't end with Client profile. If that doesn't work try using the fusion log viewer, which you'll find conviently located at C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin, or any number of other places. Run it as an admin and it'll tell you what it can't load (which may or may not be Google.Apis.Auth) and where it looked for the file at.
This has been a little bit of a red herring. Not very well documented is the fact for the app i am building against, Autodesk Navisworks,
plugin dependency libraries have to be duplicated in a separate directory altogether from the plugins directory.
Easily fixed for the build environment, but will need a little more thought for when creating a distributable.
I'm trying to connect to Google Drive with its API. Google states that it provides the necessary DLLs and references at this link here ("Download the latest version of the library"). However, when I try to add the necessary reference(s), C# is unable to find any DLLs and a manual search for them yields 0 results. From the referenced link:
The ZIP file contains the core library and Drive-specific DLLs.
Referencing these DLLs in your solution is discussed in the next
section.
The following namespaces need references:
using DotNetOpenAuth.OAuth2;
using Google.Apis.Authentication.OAuth2;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using Google.Apis.Drive.v2;
using Google.Apis.Drive.v2.Data;
using Google.Apis.Util;
using Google.Apis.Services;
In looking around on the Google link, I don't find anything with the necessary DLLs that are referenced in the above.
Note: this is a test desktop console app, not a web application.
Edit: I should add, if I add the below files as Existing Items, it still is unable to find most of the assemblies:
Google.Apis.Drive.v2.1.5.0.95-beta.nuspec
Google.Apis.Drive.v2.cs
Google.Apis.Drive.v2.csproj
packages.config
using DotNetOpenAuth.OAuth2;
using Google.Apis.Authentication.OAuth2;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using Google.Apis.Util;
using Google.Apis.Services;
You can download the API and it's dependencies via Nuget.org if you want them precompiled. The Nuget version is only slightly out-of-date however, if you want the newest version you will have to download the source and build it.
I'd say go with the Nuget version for simplicity.
Google Drive API on Nuget.org
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
VS says, The type or namespace name 'Formatters' does not exist in the namespace 'System.Runtime.Serialization'. Well, I should add this reference. Click Project > Add reference > .NET, there I can see only System.Runtime.Serialization, nothing like Formatters.
System.Runtime.Serialization.dll appears to be under c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71\ - there are no Formatters, neither Formatters.Binary there.
How to find this reference?
The BinaryFormatter is not supported in Silverlight (or Windows Phone).
So apparently Silverlight does not have the BinaryFormatter. However an open source project exists that may be able to provide similar functionality for you. It is called sharpSerializer. It will work with Silverlight and WP7.
I am keeping the other half my answer below, while not appropriate for Silverlight, may be helpful for those that are still missing said reference in other projects, as it should correct it.
For other projects that do not use Silverlight, and have access to the BinaryFormatter you may have your target framework set incorrectly.
Make sure you are using the full .NET Framework 4 Profile and not the .NET Framework 4 Client Profile in your project as your target framework. See the image below, you can find these settings in your project's properties.