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
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.configshould look like this:
You can compile for multiple targets in
csproj. Please note the trailing s in the tag name. You can also conditionally include items in
csproj. Use the following snippets:
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.jsonfile located in
Propertiesof the solution root. You can select a profile defined there when running:
dotnet run --launch-profile "Dev"
dotnet runis used to build and run from the directory where
csprojresides. It is not a good idea to run the app’s dll directly. Settings file can be missing from
binfolder and/or launch profile may not be present there.
Leave a Reply