I have my c# class library.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Keyence.IV.Sdk;
using System.Reflection;
namespace JavaKameraSchnittstelle
{
public class KeyenceKameraSchnittstellen
{
private IVisionSensor[] sensor;
private VisionSensorStore store;
private List<byte[]> images;
private DateTime lastUpdate;
private bool[] areConnected;
public KeyenceKameraSchnittstellen()
{
...
}
//Listner
public void ImageAcquired(object sender, ImageAcquiredEventArgs e)
{
...
}
public void startTickTack()
{
...
}
private void setImageAquiredListener()
{
...
}
private void readIniDatei()
{
...
}
private void init()
{
...
}
private System.Net.IPAddress getLocalIp()
{
...
}
public IVisionSensor[] getVisionSensoren()
{
...
}
public List<byte[]> getImages()
{
...
}
public bool[] getAreConnected()
{
...
}
}
}
Its based on a Keyence.IV.Sdk.dll
. I added this .dll as Assembly via Visual Studio. The compiler is friendly and shows no erros. (In a Windows-Applikation the code works fine.)
Now i want to make a Bridge with
Now i want to execute the build.cmd, but I'm getting this error:
Z:\bwulf\GeneratedSchnittstelle>build.cmd
compile classes
JavaKameraSchnittstelle.j4n.jar
JavaKameraSchnittstelle.j4n.dll clr\javakameraschnittstelle\KeyenceKameraSchnittstellen.generated.cs(58,165): error CS0400: Der Typ- oder Namespacename
'Keyence' konnte im globalen Namespace nicht gefunden werden. (Fehlt ein Assemblyverweis?) clr\javakameraschnittstelle\KeyenceKameraSchnittstellen.generated.cs(79,85): error CS0400: Der Typ- oder Namespacename
'Keyence' konnte im globalen Namespace nicht gefunden werden. (Fehlt ein Assemblyverweis?) clr\javakameraschnittstelle\KeyenceKameraSchnittstellen.generated.cs(79,125): error CS0400: Der Typ- oder Namespacename
'Keyence' konnte im globalen Namespace nicht gefunden werden. (Fehlt ein Assemblyverweis?) clr\javakameraschnittstelle\KeyenceKameraSchnittstellen.generated.cs(79,13): error CS0012: Der Typ
'Keyence.IV.Sdk.IVisionSensor' ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly 'Keyence.IV.Sdk, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null' hinzu. z:\bwulf\KameraSchnittstelle\JavaKameraSchnittstelle.dll: (Position des Symbols für den vorherigen Fehler)
I'm not familiar with c#. I found something with Assembly.LoadFile()...
but could not really do anything with it.
Where is the mistake and why i'm getting this error :
'Keyence' namespace not found.
Thank you for reading it.
You should add the contents of your build.cmd file.
Assuming your build.cmd
is equivalent to this
Csc.exe /nologo /warn:0 /reference:....\lib\jni4net.n-0.8.9.0.dll /out:work/helloWorldFromCLR.exe /target:exe Program.cs
It looks like a way to compile your C# program.
The error CS0400 says
The type or namespace name 'identifier' could not be found in the global namespace (are you missing an assembly reference?)
Essentially, your build.cmd
is not finding the other assembly - Keyence.IV.Sdk.dll
You can add it via the /reference:
option so that the compiler Csc.exe
can find the assembly. Edit your build.cmd
file and add the additional /reference:
sections for the additional assemblies you add in your Visual Studio project reference.
You can look at the full compiler options here