Does Scintilla need a directive? I keep getting an error? - c#

So, when I drag in Scintilla to my C# form, and try to run it, I get the error:
The type or namespace name
'ScintillaNet' could not be found (are
you missing a using directive or an
assembly reference?)
The error appears to be coming from the designer for Form1.
I also get the warning (but not error):
The referenced assembly "ScintillaNet"
could not be resolved because it has a
dependency on "System.Design,
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.
So, I can't run my program...
What's wrong, and how do I fix it? I've installed scintilla just like how the directions for it suggested...

I was also experiencing this error (although I am hosting in WPF not WinForms). It was caused by Visual Studio 2010 defaulting the project to .Net 4.0 Client profile rather than the full .Net 4.0 profile.

Related

NET core - Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ', .NET 6

I have converted .NET Framework 3.5 TestAPP to .NET 6 TestAPP and worked well.
i have an Automation project(C++ project) which was using .NET Framework 3.5 TestAPP.dll to run the tests, but right now i have replaced the .NET Framework 3.5
.dll with .NET 6 TestAPP i.e. TestAPP.dll
when i ran the exe in command line , i have got an error as
"Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)"
Please let me know if anything needs to be corrected.
Resolved the error by changing the C++/CLI properties from visual studio project properties , which was referring to .NET framework earlier and i have changed the property as .NET core runtime(clr:netcore) and it is internally handled all GAC changes and worked well.
Hope it might help someone .
When upgrading an app to a later .NET version, edit your csproj file and make sure there is no <RuntimeFrameworkVersion> node in there that someone may have inserted manually.
This will not be updated automatically when switching .NET versions
The running project returned this error. When I changed it to the way in the image, the error was solved.
Project>Properties
In my case the error was due to worng Default Project in Package Manager Console, if you are running EF migrations or something that is in a project that need to get info from the API make sure you are targetting the right project, also try clean + build first.

Nuget reference error, cannot find namespace

I've installed a NuGet-package required to run som code to create QR-codes. The package conflicts with system.drawing.common
Error CS0433 The type 'PixelFormat' exists in both 'CoreCompat.System.Drawing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c0a7ed9c2333b592' and 'System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
I'm trying to solve it like this:
using PixelFormat = CoreCompat.System.Drawing;
Allthough it throws an error:
Error CS0246 The type or namespace name 'CoreCompat' could not be found (are you missing a using directive or an assembly reference?)
Obviously Visual studio knows it's there somehow thoug since otherwise there would not be a conflict.
I've tried reinstalling all related NuGet-packages.
How would i go about solving this?
CoreCompat is an old library built to provide a System.Drawing compatible API that would work in Core, as originally System.Drawing was not supported. Since that time, Microsoft has released System.Drawing.Common, which is its own Core-compatible System.Drawing replacement API. Somehow, you have references to both in your project.
If your QR code library is using CoreCompat, you should really file an issue with that project to ask them to update the dependency to System.Drawing.Common. Or, you can make the change yourself and submit a pull request. Otherwise, or until it's corrected, you may need to find a different library to use.
It's possible the dependency is coming from somewhere else, as well. Check your own projects to ensure you're not bringing that in. Ultimately, you're simply going to have to do a little research here and see where CoreCompat is coming from and get rid of that.

Error when using RazorTemplates library: 'CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced'

On some machines, executing a razor template via RazorTemplates works OK.
On others, I receive the following message:
TemplateCompilationException
error CS0012: The type 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Info:
This is within a WPF application running on .NET 4.7.
The assembly has a reference to System.Runtime.4.3.0\lib\net462\System.Runtime.dll (v4.1.1.0)
However at runtime, this assembly does not show up in the 'Modules' list.
It seems the Attribute object exists in both System.Runtime and mscorlib.
Looks like this is an underlying issue somewhere between win10 and the RazorTemplates library.
In the end i switched from RazorTemplates to RazorEngine: https://github.com/Antaris/RazorEngine
And there is a page here that explains how to fix the problem via a Resolver:
https://github.com/Antaris/RazorEngine/issues/416
System.Runtime is part of the .Net Framework and is installed in the GAC during framework installation.
This could happen for two possible reasons:
It's not on the machine.
It's the wrong version.
For the machines this fails on check what version of the .Net runtime they have and/or inspect the GAC for this file and version.
Missing the framework, install it. :-)
If machines have a version but it's not the expected version do either:
Install the correct framework version
Use a binding redirect in your config file

Microsoft Fakes: Could not resolve assembly 'System.Runtime.Serialization, Version=2.0.5.0 ..."

I'm using Visual Studio 2013 Premium and trying to "Add Fakes Assembly" to a test project. The initial build gives me this error:
error : Could not resolve assembly 'System.Runtime.Serialization,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e,
Retargetable=Yes'. Are you missing an assembly reference?
The test project and the project it's targeting are both using .net 4.0. My target project does indeed use System.Runtime.Serialization, but the 4.0 version (naturally).
Why am I getting this error and how can I resolve this issue?
This is one of those slightly odd semi-ephemeral quasi-bugs that pop up from time to time. I encountered it this week through FxCop and was unable to find any resolution to it (although I didn't install Silverlight as I couldn't risk bringing down our build server).
People say that it might be to do with binding redirection for Silverlight, others have said it has something to do with portable class libraries.
Your mileage may vary; but there other people with the same problem and it seems there is no definitive cause or solution at the moment.
FxCop analysis not finding indirectly-referenced assemblies - GAC issue?
FxCop indirect reference to System.Core version 2.0.5.0
https://github.com/AutoMapper/AutoMapper/issues/383

Problem with referencing Castle.ActiveRecord.dll

I downloaded recent sources of Castle.ActiveRecord from github. I succesfully compiled it against vs2010 (targetting .Net 4.0)
I added reference to Castle.Core, Castle.ActiveRecord.dll assembly and using Castle.ActiveRecord; to my simple project (Console app, .Net 4.0)
And i got the following compile error
"The type or namespace name 'ActiveRecord' does not exist in the namespace 'Castle' (are you missing an assembly reference?)"
But this namespace exists in this assembly (I checked via object browser)
What is the problem?
Castle.Core and Castle.ActiveRecord both have a dependency on System.Web. System.Web does not exist in the .NET Client Profile (either 3.5 or 4). Look further down in your compile errors/warnings and you'll see:
The referenced assembly "Castle.Core"
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.
Go to Project Properties... Application... Target framework... and switch it to ".NET Framework 4" and you should be good.

Categories