$ dotnet new console -o faunadb-app -f netcoreapp3.1
The template "Console Application" was created successfully.
Processing post-creation actions...
Running 'dotnet restore' on faunadb-app/faunadb-app.csproj...
Restore completed in 124.88 ms for /Users/ed/Projects/MSTutorial/fauna-ex1/faunadb-app/faunadb-app.csproj.
Restore succeeded.
option 1: local source
$ dotnet add faunadb-app/faunadb-app.csproj reference ~/fauna/faunadb-csharp/FaunaDB.Client/FaunaDB.Client.csproj
Reference `..\..\..\..\fauna\faunadb-csharp\FaunaDB.Client\FaunaDB.Client.csproj` added to the project.
$ dotnet restore faunadb-app
Restore completed in 48.37 ms for /Users/ed/fauna/faunadb-csharp/FaunaDB.Client/FaunaDB.Client.csproj.
Restore completed in 48.37 ms for /Users/ed/Projects/MSTutorial/fauna-ex1/faunadb-app/faunadb-app.csproj.
option 2: NuGet repo
$ cd faunadb-app/
$ dotnet add package FaunaDB.Client --version 2.11.0
Writing /var/folders/xr/jkhhvx991994zsj4k50g7tqc0000gn/T/tmpnHsOjF.tmp
info : Adding PackageReference for package 'FaunaDB.Client' into project '/Users/ed/Projects/MSTutorial/fauna-ex3/faunadb-app/faunadb-app.csproj'.
info : Restoring packages for /Users/ed/Projects/MSTutorial/fauna-ex3/faunadb-app/faunadb-app.csproj...
info : Package 'FaunaDB.Client' is compatible with all the specified frameworks in project '/Users/ed/Projects/MSTutorial/fauna-ex3/faunadb-app/faunadb-app.csproj'.
info : PackageReference for package 'FaunaDB.Client' version '2.11.0' added to file '/Users/ed/Projects/MSTutorial/fauna-ex3/faunadb-app/faunadb-app.csproj'.
info : Committing restore...
info : Generating MSBuild file /Users/ed/Projects/MSTutorial/fauna-ex3/faunadb-app/obj/faunadb-app.csproj.nuget.g.props.
info : Writing assets file to disk. Path: /Users/ed/Projects/MSTutorial/fauna-ex3/faunadb-app/obj/project.assets.json
log : Restore completed in 783.25 ms for /Users/ed/Projects/MSTutorial/fauna-ex3/faunadb-app/faunadb-app.csproj.
$ cat faunadb-app/Program.cs
using System;
using FaunaDB.Client;
using static FaunaDB.Query.Language;
using System.Threading.Tasks;
namespace FaunaApp
{
public class MyApp
{
public static async Task DoQuery0(FaunaClient client)
{
var resp = await client.Query(Now());
Console.WriteLine("FaunaTime now is: {0}", resp);
}
static void Main(string[] args)
{
var client = new FaunaClient("secret", endpoint: "http://localhost:8443/");
DoQuery0(client).Wait();
}
}
}
Final config file:
$ cat faunadb-app/faunadb-app.csproj
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\..\..\fauna\faunadb-csharp\FaunaDB.Client\FaunaDB.Client.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>faunadb_app</RootNamespace>
</PropertyGroup>
</Project>
$ dotnet run -p faunadb-app/faunadb-app.csproj
FaunaTime now is: FaunaTime(2020-05-04T19:44:35.612Z)