Resolve conflict between System.Drawing and System.Drawing.Common - c#

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.

Related

.NETCore 3.1 - Error MC1000 Unknown build error, 'Could not find assembly 'System.Web, Version=4.0.0.0

Using Visual Studio 16.6, migrating WPF app to target .netcore3.1(.300). Cannot compile with error below:
Error MC1000 Unknown build error, 'Could not find assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.' MyApp C:\Program Files\dotnet\sdk\3.1.300\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets 225
I don't seem to have any need or reference for System.Web
I see similar things here but am on current versions:
https://github.com/dotnet/wpf/issues/2648
Any ideas?
There seemed to be an issue with the structure of the project file. I don't reference System.Web but a third party DevExpress component does.
When you target .netcoreapp31 AND net472, the Nuget packages do not seem to get pointed to the target frameworks correctly. The project file needed to be manually restructured to point them to the correct frameworks.
Details here:
Issue on github dotnet/wpf

The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0

I am using .net Framework 4.5.2. I am running MVC application. As i got new laptop I am getting the issue when running the MVC Application.
ERROR:
The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Microsoft Studio Professional 2017
Version : 15.9.12
In other teammates VS version is 15.8.1. Where it is running without any issue.
I have also installed MVC 4 and Missing plugins. Still, I am getting this issue.
please suggest to me what I need to do.
Thanks!
Deleting Bin and Obj folders worked for me.

System.Runtime 4.0.10.0 missing on Server 2012r2 after website upgrade to MVC5.1

Website works fine locally on Windows 8.1, but after publishing to Server 2012R2, certain pages get an error saying the following:
Exception message: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\b306803a\3271e75d\App_Web_sign-in.cshtml.1d427dc2.p4pq8o_l.0.cs(30): error CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I can't work out what or how is referencing that System.Runtime dll. What might I be missing and how might I track it down?
I can't work out what or how is referencing that System.Runtime dll.
What might I be missing and how might I track it down?
I am glad that you mentioned your OS is Windows 2012. The System.Runtime dll file is distributed as part of the Windows 8 SDK.
See more explanation https://stackoverflow.com/a/14517992/3918598

Compiling a C# .NET Application with a Google Voice API

So from scouring the internet I managed to find an apparently working "Google Voice API". Which is great! I'm working on an application that detects when a server process crashes / errors out and then notifies me through text. It'd be really useful because the server isn't totally reliable and on occasion needs a reset and sometimes I'm too lazy to get off my ass from the couch / busy doing something else.
Anyway, the API:
http://sourceforge.net/projects/gvoicedotnet/
I added the dll as a reference and everything loaded up well with intellisense. I added the dll into my .cs (using using [haha]). After everything was added I decided to compile just to make sure it would compile, and of course it didn't.
The Error:
Error 201 The type or namespace name 'Google' could not be found (are
you missing a using directive or an assembly reference?)
Anyway, for some reason at every compile it removes the dll as a reference? The only thing that seems to be somewhat of an indicator (which I doubt is involved) is this warning
The referenced assembly "Google.Voice.Service, Version=1.0.0.0,
Culture=neutral, processorArchitecture=MSIL" could not be resolved
because it has a dependency on "System.Web, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the
currently targeted framework
".NETFramework,Version=v4.0,Profile=Client". Please remove references
to assemblies not in the targeted framework or consider retargeting
your project.
tl;dr reference keeps automatically becoming unreferenced.
You need to change your target framework to the full .Net 4 framework and then add a reference to System.Web.

Could not load type 'System.Reflection.IntrospectionExtensions' from assembly 'mscorlib

I'm using Unity IoC (Microsoft.Practices.Unity) and I can compile fine, but I'm getting the following error at run time:
Could not load type 'System.Reflection.IntrospectionExtensions' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
The Unity version is: 3.0.1026.0
Is there a compatibility problem between .Net 4 and this version of Unity. Also, I get the same error when using Unity v2. If so, how might I go about resolving this issue?
EDIT:
Also, I've verified that mscorlib is referenced in my project.
RESOLVED.
Indeed I was using the .NET 4.5 preview version, which was referencing a class that didn't exist in my .NET 4.0 world. Thanks Hans Passant for the amazing speed in which you identified the problem!

Categories

Resources