diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/CXX_Api_Sample.cpp b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/CXX_Api_Sample.cpp
index 8a23d906fe..34765ab133 100644
--- a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/CXX_Api_Sample.cpp
+++ b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/CXX_Api_Sample.cpp
@@ -32,7 +32,13 @@ int main(int argc, char* argv[]) {
// create session and load model into memory
// using squeezenet version 1.3
// URL = https://github.com/onnx/models/tree/master/squeezenet
+#ifdef _WIN32
const wchar_t* model_path = L"squeezenet.onnx";
+#else
+ const char* model_path = "squeezenet.onnx";
+#endif
+
+ printf("Using Onnxruntime C++ API\n");
Ort::Session session(env, model_path, session_options);
//*************************************************************************
diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp
index 84fc4bb727..11dae1ab52 100644
--- a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp
+++ b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp
@@ -55,6 +55,7 @@ int main(int argc, char* argv[]) {
const char* model_path = "squeezenet.onnx";
#endif
+ printf("Using Onnxruntime C API\n");
CHECK_STATUS(OrtCreateSession(env, model_path, session_options, &session));
//*************************************************************************
diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/Microsoft.ML.OnnxRuntime.EndToEndTests.RunCapi.vcxproj b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/Microsoft.ML.OnnxRuntime.EndToEndTests.RunCapi.vcxproj
index a250d3c3cb..eb576614c8 100644
--- a/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/Microsoft.ML.OnnxRuntime.EndToEndTests.RunCapi.vcxproj
+++ b/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/Microsoft.ML.OnnxRuntime.EndToEndTests.RunCapi.vcxproj
@@ -4,6 +4,7 @@
$(MSBuildThisFileDirectory)..\..
Microsoft.ML.OnnxRuntime
+ C_Api_Sample.cpp
@@ -108,7 +109,7 @@
-
+
diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml
index c85001e7ba..ce445baa69 100644
--- a/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml
+++ b/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml
@@ -67,7 +67,23 @@ jobs:
EXIT 1
}
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- displayName: 'Run End to End Test (C++) '
+ displayName: 'Run End to End Test (C-API) '
+ timeoutInMinutes: 30
+ continueOnError: true
+
+ # test C++ API sample
+ - script: |
+ @echo ##vso[task.setvariable variable=OnnxRuntimeSampleCode]CXX_Api_Sample.cpp
+
+ - script: |
+ @echo "Running runtest.bat"
+ test\Microsoft.ML.OnnxRuntime.EndToEndTests.Capi\runtest.bat $(Build.BinariesDirectory)\nuget-artifact
+ REM Need an ErrorLevel check, since the script uses Exit /B
+ IF NOT %ERRORLEVEL% EQU 0 {
+ EXIT 1
+ }
+ workingDirectory: '$(Build.SourcesDirectory)\csharp'
+ displayName: 'Run End to End Test (C++ API) '
timeoutInMinutes: 30
continueOnError: true