-
Notifications
You must be signed in to change notification settings - Fork 4
Hello World
Guilherme Oliveira edited this page Mar 14, 2019
·
5 revisions
In an empty folder:
dotnet new console
dotnet add package CarloSharp
<!DOCTYPE html>
<html>
<head>
<title>Carlo# - Hello World</title>
</head>
<body>
Hello World!
</body>
</html><Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<!-- Copies wwwroot to the output folder -->
<ItemGroup>
<Content Include="wwwroot\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CarloSharp" Version="1.0.4" />
</ItemGroup>
</Project>using System;
using System.Threading;
namespace CarloSharp.Samples.HelloWorld
{
class Program
{
private static ManualResetEvent _exitEvent = new ManualResetEvent(false);
static void Main(string[] args)
{
var app = Carlo.Launch(new Options());
app.ServeFolder("./wwwroot");
app.Load("index.html");
app.Exit += OnAppExit;
_exitEvent.WaitOne();
}
private static void OnAppExit(object sender, EventArgs args)
{
_exitEvent.Set();
}
}
}dotnet run