Referencing OpenWebKitSharp to use WebKit in C# - c#

I am trying to reference OpenWebKitSharp, the C# library for WebKit. However, I keep getting an error on compiling: "The type or namespace WebKitBrowser does not exist in the namespace WebKit".
I am trying to follow the directions at http://code.google.com/p/open-webkit-sharp/ but I do not know what this means:
Copy the contents of the cairo build to your debug/release folder.
What is a cairo build? Why do I keep getting this error even though I am referencing both WebKit.Interop and OpenWebKitSharp?
On a similar note, is there a good site for documentation about the OpenWebKitSharp library?

If you are using .Net Framework Client Profile, change it to .Net Framework 4

Related

I am *not* missing an assembly or reference

I'm using Visual Studio 2013, and I'm getting an error in my C# code that I can't figure out. I'm working with the Microsoft Kinect SDK, but I'll keep it general.
I downloaded the SDK, and I can get the included sample programs to build and run. But when I try to use the code in my own project, I get the
Type or namespace name 'Kinect' does not exist in the namespace 'Microsoft' (Are you missing an assembly reference)
error.
The thing is, I'm not missing an assembly or reference. I have it added to the project's references, and the path is valid. Also, the using statements at the top of the file will autocomplete to "Kinect" for me. If I start typing using Microsoft., Kinect will appear as an autocomplete option.
What are the steps to debugging an error such as this? Could it be a 32/64 bit issue? I tried using Dependency Walker to look at the Kinect DLL, and while it throws some errors (Error: Modules with different CPU types were found.), it doesn't show any issues that I don't see with other DLLs that I'm using successfully.
What are some other potential issues that might cause a problem with DLLs not being recognized?
1 - Try going to your project settings and verify the version of the .NET framework it uses.
The best to do is to choose the same version as the external libraries.
If it's a client profile, it will very often bring that exact problem. (I'm not sure what the client profile is, but I ended up never using it...)
2 - Check if any of your references got an exclamation mark.

How to use XDocument class in Mono

I'm trying to use XDocument class inside a Unity3D project on Windows 7.
I did the following:
added the reference System.Xml.Linq to the Mono project.
included the namespace:
using System.Xml.Linq;
set the target framework to: Mono/.NET 3.5
clean and rebuild the project
But still Unity3D complains about it. Here's the error output in the console:
Assets/Scripts/Editor/RoadManager/RoadManager.cs(3,18): error CS0234:
The type or namespace name `Linq' does not exist in the namespace
`System.Xml'. Are you missing an assembly reference?
Any idea?
This has been discussed many times before, but few of these answers are complete.
As has been said before, Unity3d only supports up to .NET version 2.0, and it seems System.Xml.Linq was introduced in .NET 3.5, besides the fact that it is not listed on the Unity3d compatibility list anywhere.
The only things to try are to set the Mono API compatibility level to 2.0 (Menu: Edit > Project Settings > Player and look in the Other Settings panel), but it seems that that was a mistaken solution for Linq2SQL.
Another possible solution is to add the DLL yourself into the Unity Editor as shown:
Try dragging the C:\Program Files
(x86)\Unity\Editor\Data\Mono\lib\mono\2.0\System.Xml.Linq.dll file
into the unity project window like you would a texture or other game
asset.
If none of these yield ANY luck for you, then I'm afraid you are out of luck.
Unity3D supports .Net 2.0 only, so setting compatibility to .net 3.5 in MonoDevelop/Visual Studio will not work. You will have to make do without the class. This shows what library classes are available:
http://docs.unity3d.com/Documentation/ScriptReference/MonoCompatibility.html
See also this post in UnityAnswers: http://answers.unity3d.com/questions/46039/can-not-reference-systemxmllinq.html

The type or namespace name could not be found [duplicate]

This question already has answers here:
Getting "type or namespace name could not be found" but everything seems ok?
(44 answers)
Closed 8 years ago.
I have a C# solution with several projects in Visual Studio 2010.
One is a test project (I'll call it "PrjTest"), the other is a Windows Forms Application project (I'll call it "PrjForm"). There is also a third project referenced by PrjForm, which it is able to reference and use successfully.
PrjForm references PrjTest, and PrjForm has a class with a using statement:
using PrjTest;
Reference has been correctly added
using statement is correctly in place
Spelling is correct
PrjTest builds successfully
PrjForm almost builds, but breaks on the using PrjTest; line with the error:
The type or namespace name 'PrjTest' could not be found (are you missing a using directive or an assembly reference?)
I've tried the following to resolve this:
Removed Resharper (since Resharper had no trouble recognizing the referenced project, I thought it might be worth a shot)
Removed and re-added the reference and using statement
Recreated PrjForm from scratch
PrjForm currently resides inside the PrjTest folder, I tried moving it to an outside folder
Loaded the solution on a different computer with a fresh copy of VS 2010
I have done my homework and spent far too long looking for an answer online, none of the solutions has helped yet.
What else could I try?
See this question.
Turns out this was a client profiling issue.
PrjForm was set to ".Net Framework 4 Client Profile"
I changed it to ".Net Framework 4", and now I have a successful build.
Thanks everyone!
I guess it figures that after all that time spent searching online, I find the solution minutes after posting, I guess the trick is knowing the right question to ask..
In my case I had:
Referenced DLL : .NET 4.5
Project : .NET 4.0
Because of the above mismatch, the 4.0 project couldn't see inside the namespace of the 4.5 .DLL. I recompiled the .DLL to target .NET 4.0 and I was fine.
PrjForm was set to ".Net Framework 4 Client Profile" I changed it to ".Net Framework 4", and now I have a successful build.
This worked for me too. Thanks a lot. I was trying an RDF example for dotNet where in I downloaded kit from dotnetrdf.
NET4 Client Profile:
Always target NET4 Client Profile for all your client desktop applications (including Windows Forms and WPF apps).
NET4 Full framework:
Target NET4 Full only if the features or assemblies that your app need are not included in the Client Profile. This includes:
If you are building Server apps, Such as:
ASP.Net apps
Server-side ASMX based web services
If you use legacy client scenarios, Such as:
o Use System.Data.OracleClient.dll which is deprecated in NET4 and not included in the Client Profile.
Use legacy Windows Workflow
Foundation 3.0 or 3.5 (WF3.0 , WF3.5)
If you targeting developer scenarios and need tool such as MSBuild or need access to design assemblies such as System.Design.dll
Another thing that can cause this error is having NuGet packages that have been built with a newer version of .NET.
The original error:
frmTestPlanSelector.cs(11,7): error CS0246: The type or namespace name 'DatabaseManager'
could not be found (are you missing a using directive or an assembly reference?)
Further up in the log I found this:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3275: The primary reference "[redacted]\DatabaseManager\bin\Release\DatabaseManager.dll" could not be resolved because it has an indirect dependency on the assembly "System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".
The solution was to re-install the NuGet packages:
http://docs.nuget.org/docs/workflows/reinstalling-packages
I solved mine because the other project was coded with .NET 4.5 and the other one was coded 4.0
The using statement refers to a namespace, not a project.
Make sure that you have the appropriately named namespace in your referenced project:
namespace PrjTest
{
public class Foo
{
// etc...
}
}
Read more about namespaces on MSDN:
Using Namespaces
I encountered this issue it turned out to be.
Project B references Project A.
Project A compiled as A.dll (assembly name = A).
Project B compiled as A.dll (assembly name A).
Visual Studio 2010 wasn't catching this. Resharper was okay, but wouldn't compile. WinForms designer gave misleading error message saying likely resulting from incompatbile platform targets.
The solution, after a painful day, was to make sure assemblies don't have same name.
It is also possible, that the referenced projects targets .NET 4.0, while the Console App Project targets .NET 4.0 Client Library.
While it might not have been related to this particular case, I think someone else can find this information useful.
The compiled dll should have public Class.
I had the same issue. The target frameworks were fine for me. Still it was not working.
I installed VS2010 sp1, and did a "Rebuild" on the PrjTest. Then it started working for me.
Other problem that might be causing such behavior are build configurations.
I had two projects with configurations set to be built to specific folders.
Like Debug and Any CPU and in second it was Debug and x86.
What I did I went to Solution->Context menu->Properties->Configuration properties->Configuration and I set all my projects to use same configurations Debug and x86 and also checked Build tick mark.
Then projects started to build correctly and were able to see namespaces.
Changing the framework to
.NET Framework 4 Client Profile
did the job for me.
For COM/ActiveX references, VS 2012 will show this error right on using statement. Which is quite funny, since it's saying that may be you are missing a using statement.
To solve this: register the actual COM/ActiveX dll even if it's in the neighbor project, and add a reference through COM channel, not project channel. It will add Interop.ProjectName instead of ProjectName as a reference and this solves this strange bug.
If your project (PrjTest) does not expose any public types within the PrjTest namespace, it will cause that error.
Does the project (PrjTest) include any classes or types in the "PrjTest" namespace which are public?
just changed Application's target framework to ".Net Framework 4".
And error got Disappeared.
good luck;
:D
check your Project Properties, your Reference Paths should be empty like this:
Regards

"System.Action claims it is defined" error

I'm building a Silverlight 4.0 application with .NET Framework 4.0, and I'm seeing this error:
Reference to type System.Action claims it is defined in 'c:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\mscorlib.dll', but it could not be found (CS1684) - c:\Program Files\MSBuild\Seesmic\SDP\Seesmic.Sdp.Utils.dll
In my project I have a reference to the same mscorlib.dll that it's claiming to be defined in. Any ideas?
That's an odd location for a DLL (within the MSBuild directory). Is it possible that it's trying to use a reference to a desktop assembly from within your Silverlight application? Admittedly with the assembly portability in v4 I'd half expect that not to be a problem, but it's worth looking into.
If you could give more details about how you're building and where Seesmic comes into the frame, that would help.
Seesmic.Sdp.Utils.dll is probably requiring a different version of the mscorlib.dll because it was compiled referencing that different version. In Seesmic.Sdp.Utils.dll there is a class using System.Action as base class, that only works if you reference the same version of mscorlib.dll containing the same System.Action, otherwise you won't be able to use that class.
Sometimes you create a class say 'YourClass.cs' in your project say 'YourProject.YourModule'. After some time, you comment out YourClass.cs content since you do not want it now. But you do not exclude that .cs file from your project. In such case, compiler will give you warning while building the project like 'claims it is defind'. This is because project file contains the entry for this .cs file. When someone tries to use reflection on that project dll then this error prevents the code from accessing that class since it is actually not present physically but only in project file.

Namespace in Referenced Project Present in Autocomplete Before Building, but Causes Compile Error After Building

I have a class library project which uses a namespace (e.g., "Cosmos.Creator.Util"). I then create a solution and windows forms application to test the library. From the windows form application, I add a reference to the library. So now I have two projects open in visual studio, a class library and a windows forms project. The forms project references the library.
When I edit my form's code, code autocompletion works correctly for the namespace that I use in the library. E.g., if I type "using Cosmos." I get autocomplete options like "Creator". But now if I build my solution, all of the "Cosmos" are red-underlined with the compile error: "The type or namespace name "Cosmos" could not be found (are you missing a using directive or an assembly reference?)".
For the purposes of the form application test, I placed my library code into a folder CosmosFormExample\Cosmos. When I check the reference from the form application, the reference is to CosmosFormExample\Cosmos\bin\Debug\Cosmos.dll, so that looks okay. I looked at the GUID referenced in the solution file and it matches the GUID of the project file Cosmos.csproj.
What has happened? How has the build caused my forms application to forget about the Cosmos namespace, despite the fact that it is still referencing the library project? Thanks much in advance.
Are you using VS2010 & .NET 4? If so you're probably using .NET 4 Client Profile instead of full fledged .NET 4. Go to project properties and check your Target Framework.
for more info: http://msdn.microsoft.com/en-us/library/cc656912.aspx
you need to check the framework you are using and the framework yout library was compiled for...

Categories

Resources