I am attempting to pull metadata from photos in a .Net Core App by using this library:
https://www.codeproject.com/Articles/27242/ExifTagCollection-An-EXIF-metadata-extraction-libr
However while implementing the ExifTagCollection class I am getting the Error listed in the title.
I have successfully referenced System.Drawing but it is not recognizing its drawing extension. Any help would be great. Also open to suggestions for other libraries to accomplish my goal. Thx
If you're looking for System.Drawing-related functionality on .NET Core, you should be able to use System.Drawing.Common.
It provides the System.Drawing API on .NET Core and works on Windows, Linux and macOS.
If you're on Linux and macOS, you'll need to install libgdiplus for this to work. To install libgdiplus on macOS, run brew install mono-libgdiplus; on Linux you should be able to install the libgdiplus package using your package manager. This deployment will hopefully get easier in the future.
It's currently in preview on NuGet as the System.Drawing.Common package.
Long term, you may want to consider migrating to other libraries such as ImageSharp.
If you take a look at the site of microsoft you will see:
"Classes within the System.Drawing.Imaging namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions."
You are creating a web application with ASP.net so this class isn't supported for your project
As #TimonPost says, you cannot use that namespace from ASP.NET, because it relies on there being an interactive session (which is why it also won't work from a Windows Service).
If you just want an easy way to access metadata from images that works in ASP.NET Core, check out my MetadataExtractor library.
https://github.com/drewnoakes/metadata-extractor-dotnet
Related
I am currently working on a WinForms app in Visual Studio 2019, which uses a USB to I2C adapter to read EEPROM register values from a device. The manufacturer of the adapter provides the driver for the device in a downloadable zip file on their website which contains the .inf and .sys files among other things. I would like to have it so when the end user installs the app, the driver is automatically installed as well. What is the best way to do this? I have a Setup project in my solution, which I can use to put the driver files in the application folder, but that doesn't mean the driver is actually set up.
I found one potential solution that used System.Configuration.Install, but my targeted framework at the moment is .NET core 3.1, which unlike .NET framework does not have that namespace. I am only expecting users to use Windows 10, so I theoretically could switch to .NET framework for that namespace if necessary. However, I don't know if that will break anything in the app or if that is the easiest way to go about this.
I am very new to deploying apps so I really don't know the best way to go about this. Any direction is appreciated.
There are third-party .net core ways of doing this, such as
Core.System.Configuration.Install
Porting of System.Configuration.Install for .NET Core. (.NET 4.0
version)
Use at your own risk
however, there are also oodles of installers that have this capabilities.
Lastly, this can also be done with powershell, P/invoke and I believe there was talk in github about releasing this source code however you will need to track that down and follow the trail yourself
We are building a .Net Core 2.0 C# web app that uses System.Drawing package.
I am writing code on Mac, but it will be also developed on the Windows machine, and deployed into Linux server.
To use System.Drawing on OSX I had to add runtime.osx.10.10-x64.CoreCompat.System.Drawing Nuget package to my project dependencies.
But that code now doesn't work on the Window machine.
We get the System.AccessViolationException when trying to use DrawString method of Graphics (part of System.Drawing) object.
So, my question is what is common way to solve this?
Is it even possible to use System.Drawing classes in this multi-os setup?
The same System.Drawing code should work on Linux, Windows and macOS without any changes. You're correct that you need to either manually install libgdiplus (e.g. via brew install mono-libgdiplus) or reference runtime.osx.10.10-x64.CoreCompat.System.Drawing for System.Drawing to work on a Mac.
System.Drawing will work on Windows without any external dependencies.
If you're still using CoreCompat.System.Drawing (which I maintain), I'd recommend you migrate to System.Drawing.Common instead - this the is Microsoft implementation of System.Drawing for .NET Core.
If the issue then still reproduces on Windows, your best bet would be copy a should piece of code which can be used to reproduce your issue, so I can have a look at it.
I have made an application using C# in windows forms. I am using Install shield 2010 to create a setup file for the application. It asks me what it should check for as prerequisites which it would check for before starting to install on any other device.
However, I do not know what I should include as prerequisites for my windows application. I do not know if it requires .net 4.5 or 4 or 3.5... I also had downloaded and included some references in the project and do not know if they are being included in the setup or not...
Please help
You need to look at the project properties of your winform app and see what version of the .NET framework you are building against. In some cases you can do things like compile against .NET 2.0 but then have an App.Config file that says 2.0 and 4.0 are supported runtimes. This gives you flexibility in choosing which if any .NET to redistribute.
From there you have to look at your dependencies (references) and there dependencies. It's possible that they require additional things such as C++ runtimes, database engines. For each of these you have to figure out if it's already part of windows, if a third party redistributable exists, can it be statically linked or privately deployed and so on.
There is no one simple answer. You just have to be familiar with your code base, what it requires and what the best practices are for each of those items.
I am currently trying to make use of DropNet to make a simple Modern UI application that will be able to access users' Dropbox accounts and upload files. However, DropNet apparently only supports .NET 3.5.
I've been trying to make the application utilize the .NET 3.5 runtime (rather than 4.5), but to no avail. I choose the appropriate .NET version like so:
Yet when I try to confirm the version, it shows a greyed out box like this:
This contrasts with non Modern UI apps, which show the appropriate version and give you the ability to change it.
When I try to obtain DropNet through NuGet, it throws up an error (as you'd probably expect):
Could not install package 'DropNet 1.9.3'. You are trying to install this package into a project that targets '.NETCore,Version=v4.5', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.
Is there any way to achieve what I'm trying to do?
You cannot make this work. A Store app project must target .NET 4.5, the only version of .NET that's compatible with the language projection that's needed to make .NET programs work on WinRT. In addition, the profile that permits WinRT programming (.NETCore as shown in the error message) is strictly limited and does not support references to .NET assemblies that target older versions of .NET.
I'm not aware of a 4.5 Store compatible wrapper for the DropBox api. You could possible take advantage of their generic REST api. Beware the general trouble you'll have making it work, and surely the reason that a 4.5 wrapper isn't available, Windows suspends a Store app when the user switches away from it. Which will interrupt a file transfer. A highly likely occurrence, the user won't have much patience with it.
I have developed an windows desktop Application using C# .NET 4 framwork.Now, we are going to using MONO2.10 for cross platform.For sample, I have downloaded the mono 2.10 on windows version and able to run my .net exe.While doing so, Its Working fine and it says error the below mentioned error msg. As per my understanding, I think the DLL Reference is not included properly...
i am using 2 third party dll files in application.
Ionic.dll for .net zip library
DocumentFormat.OpenXml.dll for XML file management.
Please guide me to how to include these dll reference in Mono on windows?
Thanks & Regards,
Saravanan.P
This library is not part of Microsoft .NET or Mono Framework.
Therefore, you just need to either put it in GAC or in the same folder with your application, just like you normally do with third-party components.