c# - Vector CANoe - 如何构建具有多个 C# 文件的 .NET 测试节点?
问题描述
目标
我想使用 Vector CANoe C# (.NET) 脚本功能。
更具体地说,我想通过构建一些核心实用程序类来降低 .NET 测试节点的复杂性。
例如,而不是拥有这个
// With the Vector API directly
IVT2516Channel M4_Ch9 = vts.GetChannel("M4_Ch9");
M4_Ch9.DigitalOutput.Value = true;
一个对象可以这样做:
// With an Object that abstract the Vector API
MyECU ecu = utilities.MyECU();
ecu.OpenContactor(True);
为了实现这一点,我的计划是构建一个utilities.cs
每个 .NET 测试模块都会使用的文件。
思路大致是这样的:
+---------------------------+
| CANoe Test environment |
| |
| +--------+ +--------+ |
| | .NET | | .NET | |
| | test | | test | |
| | module | | module | |
| +--------+ +--------+ |
| | | |
+--------|---------|--------+
| |
+--------v---------v--------+
| |
| CORE UTILITIES (C#) |
| |
+---------------------------+
|
+------------v--------------+
| |
| VECTOR Modules |
| |
+---------------------------+
问题
我不能让编译器满意。我总是收到错误 CS0246。在 CANoe 控制台中:
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?)
使用 Visual Studio 时,我的解决方案构建没有问题。
问题
如何构建具有多个 C# 文件的 .NET 测试节点?
解决方案
我认为您utilities.cs
在 CANoe 测试配置中选择了该文件。
使用该设置,CANoe 将仅编译单个文件,即使您可以在 Visual Studio 中编译整个项目。
但是,CANoe 不仅支持.cs
文件,还支持.dll
和.sln
文件。
了解这一点后,您可以简单地更改配置以使用 Visual Studio 项目的解决方案文件或输出 DLL 文件。
注意:我遇到了同样的问题,我在寻找解决方案时发现了这篇文章。
推荐阅读
- ms-access - 如何要求用户确认对访问记录的编辑
- azure-active-directory - 我们如何使用 msal 更新 idtoken?
- ios - MGLMapView scaleBar 位置在底部通过更新约束
- react-native - 使用图像上的时间戳更新图像
- python - Word2Vec 太多值无法解包错误
- amazon-web-services - 问初始化.....不工作
- c# - C# 只读跨度
vs 字符串剖析的子字符串 - java - 检查括号是否匹配总是说它们匹配
- acumatica - 在代码上查找 Acumatica 的版本
- php - 如何将当前时间戳插入数据库?