Skip to content

dhruvb14/DotNetCore2StandAlone

Repository files navigation

6/5/2018 - Since this was written a new default angular template has been released. I recommend cloning as the new template has not been tested with self contained executable implementation.

Standalone Dotnetcore MVC Angular SPA

Purpose

This POC was created so you could create an application which can be distributed to end users using web technology and run by simply clicking a EXE and navigating to the local url. It will be updated with additional features down the road including sqllite database with EntityFramework as the ORM.

How it was built

Building requires node.js latest LTS and dotnetcore 2x latest sdk

Requires VSCode or VS2017+ (Optimized for VSCode)

THIS TEMPLATE IS BASED ON THE MICROSOFT SPA SERVICES AUTOGENERATED ANGULAR AND MVC PROJECT

If you wanted to build this yourself and not just fork my repo here is how I did it

  1. dotnet new angular
  2. npm install
  3. modify files mentioned below
  4. dotnet publish -c Release -r win10-x64
  5. Grab output files from bin\Release\netcoreapp2.0\win10-x64\publish
  6. Double Click the EXE or if on Mac Use mac commands

Modified Files:

./vscode/launch.json

./Views/Home/Index.cshtml

./DotNetCore2StandAloneOutput.csproj (Added runtime identitifers and output type on line 8-9)

Features

  • Full VS Code Debugger support for both C# and Angular Frontend code when launched using the ".Net+Browser" Profile

  • Support Hot Module Replacement when running in development builds but is not used in production (This was implemented using a quick if statement in the index.cshtml file to check if dev/prod)

Build/Release Section

PC Standalone Release

replace win10-x64 with win-x64 for Generic support for all W7+

  • dotnet publish -c Release -r win10-x64
  • cd bin\Release\netcoreapp2.0\win10-x64\publish
  • run DotNetCore2StandAlone.exe

Mac Standalone Release

replace osx.10.11-x64 with osx-x64 for Generic support for all OSX 10.12+

  • dotnet publish -c Release -r osx.10.11-x64
  • cd bin/Release/netcoreapp2.0/osx.10.11-x64/publish
  • chmod a+x DotNetCore2StandAlone
  • ./DotNetCore2StandAlone

Linux Standalone Release (Generic and Untested)

  • dotnet publish -c Release -r linux-x64
  • cd bin/Release/netcoreapp2.0/linux-x64/publish
  • chmod a+x DotNetCore2StandAlone
  • ./DotNetCore2StandAlone

Additional Build Targets

If you want to support additional specific build targets check out the following link: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog and add the build targets to the ./DotNetCore2StandAlone.csproj on Line 8

Entity Framework With SQLLite

If you look in the documents folder you will see that there is a postman collection which you can import and do Create's reads and updates to the sqllite database using simple rest commands in postman. Angular UI Pieces are not yet built for this yet.

About

POC For Standalone distributed DotNetCore2 Application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published