Skip to content

Latest commit

 

History

History

README.md

NativeScriptWindowsDemo Template (Windows)

This is the base C# harness template for NativeScript Windows apps generated by the CLI.

Layout

  • 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.

Runtime integration

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:

  1. Build bridge DLL:
    • cargo build -p nativescript
  2. Copy script and DLL:
    • copy /Y NativeScriptWindowsDemo\\app\\main.js ConsoleNativeScriptWindowsDemo\\app\\main.js
    • copy /Y target\\debug\\nativescript.dll ConsoleNativeScriptWindowsDemo\\libs\\nativescript.dll
  3. Run harness:
    • dotnet run --project ConsoleNativeScriptWindowsDemo\\ConsoleNativeScriptWindowsDemo.csproj

UWP template run

  1. Ensure nativescript.dll exists under NativeScriptWindowsDemo/libs.
  2. Build and deploy NativeScriptWindowsDemo.sln from Visual Studio (Debug/x64 recommended for dev).
  3. Inspect Debug Output for the same PASS/FAIL summary lines.

Template expectations

The CLI should:

  1. Copy/produce runtime binaries into libs/.
  2. Populate app/main.js (or additional files under app/).
  3. Build/deploy the UWP app project.

Notes

app and libs are copied to output via wildcard include in NativeScriptWindowsDemo.csproj.

  • This harness is intentionally minimal and template-friendly.