I’ve been working with .NET core recently and I’d like to post some random observations on this subject for the future reference.
-
It is possible to create Nuget package upon build. This option is actually available also from the VS2017 Project properties GUI. Add this code to
csproj
. -
It is possible to add local folder as Nuget feed. The folder can also be current user’s profile. This one is actually not Core specific.
Nuget.config
should look like this: -
You can compile for multiple targets in
.NET Core
compatiblecsproj
. Please note the trailing s in the tag name. You can also conditionally include items incsproj
. Use the following snippets:and:
There is a reference documentation for the available targets: here.
-
The listening port in Kestrel can be configured in multiple ways. It can be read from environment variable or can be passed as command line argument. An asterisk is required to bind to physical interfaces. It is needed e.g. when trying to display the application from mobile phone when being served from development machine. The following are equivalent:
set ASPNETCORE_URLS=http://*:11399 --urls http://*:11399
-
The preferred way to pass hosting parameters to Kestrel is
launchSettings.json
file located inProperties
of the solution root. You can select a profile defined there when running:dotnet run --launch-profile "Dev"
dotnet run
is used to build and run from the directory wherecsproj
resides. It is not a good idea to run the app’s dll directly. Settings file can be missing frombin
folder and/or launch profile may not be present there.