I'm trying to write some C# .NET application to execute it on Nano Server. Here's the source code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello hello world");
}
}
}
Obviously, this code is running successfully on Windows 10 system.
PS C:\Users\roza\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\bin\Debug> .\ConsoleApp1.exe
Hello hello world
As I understood, there're .NET Core installed on Nano Server by default, so I suppose it's possible to execute this code on Nano Server somehow.
When I copied the compiled *.exe file to Nano Server and tried to execute it there first time, I got this error:
[Nano1X]: PS C:\Users\Administrator\Documents> .\ConsoleApp1.exe
Program 'ConsoleApp1.exe' failed to run: The subsystem needed to support the image type is not present.
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
[Nano1X]: PS C:\Users\Administrator\Documents>
Then I realized that Nano Server supports only x64 architecture, so I went through "Project->ConsoleApp1 Properties->Build->Platform Target: x64" and executed my app on Nano Server one more time.
[Nano1X]: PS C:\Users\Administrator\Documents> .\ConsoleApp1.exe
[Nano1X]: PS C:\Users\Administrator\Documents>
I just got nothing printed: no errors and no any result. What's the reason of it and what should I do if I really want my C# .NET application to be successfully executed by Nano Server?