- .NET Core SDK, as a Microsoft installation. It is available as a Homebrew cask, but that installation option doesn't work (out of the box, at least) with Visual Studio Code, probably due to PATH issues.
- Visual Studio Code.
- The VS Code C# extension (the one from Microsoft). Make sure all its dependencies (i.e. OmniSharp) download and initialize successfully.
Build using your IDE, or with the dotnet
command. Without .NET Framework, you won't be able to build for all target frameworks, so for Castle.Sdk
you must specifically build for .NET Standard using the -f
switch
dotnet build src/Castle.Sdk/Castle.Sdk.csproj -f netstandard2.1
Use an xUnit-compatible test runner (e.g. the VS Code extension .NET Core Test Explorer), or
dotnet test src/Tests/Tests.csproj
There should be options above each test in Visual Studio Code: Run Test
and Debug Test
. If there aren't, and you just installed VS Code and/or the dotnet SDK, try reopening the project folder.
The goal of the SDK project is to produce a NuGet package. With a .NET Standard library, like Castle.Sdk
, packing is done with the command
dotnet pack [path to project]
However, since the library targets both .NET and Framework, pack
requires .NET Framework to be installed, which means it only works on Windows machines. So, we do the packing in the AppVeyor build process. The finished package can be downloaded from the Artifacts tab for a build.
Packages are pushed to a package feed (repository) like this
dotnet nuget push [path to package] -s [package source]
If you're pushing to nuget.org you also need to supply a key using the -k
switch.
When developing, it can be useful to add development packages (i.e. not available on nuget.org) for use in test applications. In that scenario you can use a local folder as NuGet feed
- Download the package from AppVeyor
- Push to a local folder, e.g.
dotnet nuget push [path to package] -s ~/Code/packages
- [update only] Clear the NuGet cache, so you know your project will get the latest build of this package version
dotnet nuget locals all --clear
- [update only] Remove the package from your project
dotnet remove package Castle.Sdk
- Add the new package build
dotnet add package Castle.Sdk -s [path to local folder]
For details on packing in a release scenario, see the Releasing doc.