NativeScriptWindowsDemo Template (Windows)
This is the base C# harness template for NativeScript Windows apps generated by the CLI.
- App/main.js: JavaScript app entry.
- libs/: Place native runtime bridge binaries here (for example nativescript.dll).
- RuntimeHost.cs: Runtime bootstrap and script execution glue.
RuntimeHost calls into the exported bridge functions:
- runtime_install_ctrlc_handler(exitCode)
- runtime_init(appRoot)
- runtime_runscript(runtime, script)
- runtime_deinit(runtime)
Running conformance tests
app/main.js includes runtime conformance checks for:
- Class.extend({ ... })
- Class.extend("Name", { ... })
- new SomeInterface({ ... })
- Object.extend({ interfaces: [...], ... })
- delegate/event helper semantics (NSWinRT.asDelegate, NSWinRT.createEventEmitter)
The script prints per-test lines and a summary:
- [PASS] <test name>
- [FAIL] <test name> - <reason>
- [TEST SUMMARY] passed=X, failed=Y
Fast loop with ConsoleNativeScriptWindowsDemo
From workspace root:
- Build bridge DLL:
- cargo build -p nativescript
- Copy script and DLL:
- copy /Y NativeScriptWindowsDemo\\app\\main.js ConsoleNativeScriptWindowsDemo\\app\\main.js
- copy /Y target\\debug\\nativescript.dll ConsoleNativeScriptWindowsDemo\\libs\\nativescript.dll
- Run harness:
- dotnet run --project ConsoleNativeScriptWindowsDemo\\ConsoleNativeScriptWindowsDemo.csproj
- Ensure nativescript.dll exists under NativeScriptWindowsDemo/libs.
- Build and deploy NativeScriptWindowsDemo.sln from Visual Studio (Debug/x64 recommended for dev).
- Inspect Debug Output for the same PASS/FAIL summary lines.
The CLI should:
- Copy/produce runtime binaries into libs/.
- Populate app/main.js (or additional files under app/).
- Build/deploy the UWP app project.
app and libs are copied to output via wildcard include in NativeScriptWindowsDemo.csproj.
- This harness is intentionally minimal and template-friendly.