Objectives
I want to use the Vector CANoe C# (.NET) scripting capability.
More specifically, I want to reduce my .NET test nodes' complexity by building some core utility classes.
For example, instead of having this
// With the Vector API directly
IVT2516Channel M4_Ch9 = vts.GetChannel("M4_Ch9");
M4_Ch9.DigitalOutput.Value = true;
An object could do this:
// With an Object that abstract the Vector API
MyECU ecu = utilities.MyECU();
ecu.OpenContactor(True);
To achieve this, my plan was to build a utilities.cs
file that every .NET tests module would use.
The idea is roughly this:
+---------------------------+
| CANoe Test environment |
| |
| +--------+ +--------+ |
| | .NET | | .NET | |
| | test | | test | |
| | module | | module | |
| +--------+ +--------+ |
| | | |
+--------|---------|--------+
| |
+--------v---------v--------+
| |
| CORE UTILITIES (C#) |
| |
+---------------------------+
|
+------------v--------------+
| |
| VECTOR Modules |
| |
+---------------------------+
Problem
I can't get the compiler happy.
I always get error CS0246.
In the CANoe console:
System Testmodule 'Test 1': Compilation of tests_wakeup.cs' failed with error(s)
System tests_wakeup.cs(17,7): error CS0246: The type or namespace name 'utilities' could not be found (are you missing a using directive or an assembly reference?)
When using the Visual studio, my solution build without problems.
Question
How do you build a .NET tests node with multiple C# files?
I think you selected the file utilities.cs
in the CANoe test configuration.
With that setting, CANoe will only compile a single file, even if you can compile the whole project in Visual Studio.
However, CANoe does not only support .cs
files but also .dll
and .sln
files.
Knowing this, you can simply change your configuration to use the solution file of the Visual Studio project or the output DLL file.