This plugin automatically runs dotnet restore
and dotnet lambda package
during package and deployment of Serverless functions. This removes the need for extra build scripts to run these commands manually.
Tested against Serverless v1.17.0
Inspired by https://github.com/fruffin/serverless-dotnet
To use this package you will need to have dotnet core installed for use of the dotnet
command line binary.
Available from: https://www.microsoft.com/net/core
To install, add serverless-dotnet-package to your package.json
:
npm install serverless-dotnet-package --save
Now add the plugin to your serverless.yml
:
plugins:
- serverless-dotnet-package
The default settings of the plugin will create a package with just the compiled code using Release mode and netcoreapp1.0.
An example of all options is:
dotnetpackage:
include:
- extra/**
configuration: Debug
framework: netcoreapp1.1
Sometimes it can be helpful to include extra files along with your compiled code. This can be done by listing globs of files to include in the include section. This is similar to the default Serverless mechanism of including extra files.
dotnetpackage:
include:
- extra/**
Configuration can be changed to Debug mode, and different versions of the framework. The default options use Release mode and netcoreapp1.0 - this can be changed as in the example to other options.
dotnetpackage:
configuration: Debug
framework: netcoreapp1.1
This package overrides the default packaging behaviour of Serverless and thus the default include/exclude options of the framework will do nothing.