Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade 'VB Hello World' sample #8137

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions samples/VBHelloWorld/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\VBGrains\VBGrains.vbproj" />
<ProjectReference Include="..\Interfaces\Interfaces.vbproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Orleans.Core" Version="3.4.2" />
<PackageReference Include="Microsoft.Orleans.OrleansRuntime" Version="3.4.2" />
<PackageReference Include="Microsoft.Orleans.CodeGenerator.MSBuild" Version="3.4.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Orleans.Server" Version="7.0.0" />
</ItemGroup>
</Project>
10 changes: 4 additions & 6 deletions samples/VBHelloWorld/HelloWorld/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,26 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Orleans;
using Orleans.CodeGeneration;
using Orleans.Hosting;
using VBGrains;

[assembly: KnownAssembly(typeof(HelloGrain))]
[assembly: KnownAssembly(typeof(IHelloGrain))]
[assembly: GenerateCodeForDeclaringAssembly(typeof(HelloGrain))]
[assembly: GenerateCodeForDeclaringAssembly(typeof(IHelloGrain))]

using var host = new HostBuilder()
.UseOrleans(builder =>
{
builder.UseLocalhostClustering();
})
.UseConsoleLifetime()
.Build();

await host.StartAsync();

var grainFactory = host.Services.GetRequiredService<IGrainFactory>();
var friend = grainFactory.GetGrain<IHelloGrain>(0);
Console.WriteLine("\n\n{0}\n\n", friend.SayHello("Good morning!").Result);
Console.WriteLine("\n\n{0}\n\n", await friend.SayHello("Good morning!"));

Console.WriteLine("Orleans is running.\nPress Enter to terminate...");
Console.ReadLine();
Console.WriteLine("Orleans is stopping...");

await host.StopAsync();
6 changes: 3 additions & 3 deletions samples/VBHelloWorld/Interfaces/Interfaces.vbproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Orleans.Core" Version="3.4.2" />
<PackageReference Include="Microsoft.Orleans.Core" Version="7.0.0" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions samples/VBHelloWorld/VBGrains/VBGrains.vbproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Interfaces\Interfaces.vbproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Orleans.Core" Version="3.4.2" />
<PackageReference Include="Microsoft.Orleans.Core" Version="7.0.0" />
</ItemGroup>
</Project>