0

I have a .net core web app that I would like to install as a regular app on Windows or OSX. If I deploy that as a self contained app, will the web server start when the .exe is run? And, how can I configure what port the app will listen on?

My long term goal would be to create a UI to let the user configure some stuff and have the app distributable from Windows Store and/or Mac AppStore, but I'm not sure if this is possible?

1

1 Answer 1

3

In order to deply as a self contained app you need to specify a runtime in your csproj file. :

<PropertyGroup>
    <RuntimeIdentifiers>win10-x64;osx.10.11-x64;ubuntu.16.10-x64</RuntimeIdentifiers>
</PropertyGroup>

Than publish the application for that runtime:

dotnet publish -c Release -r win10-x64

If you want to change the port your application is listening on you need to set that in the Program.cs file:

    public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup<Startup>()
            .UseApplicationInsights()
            // Set url and port here.
            .UseUrls("http://0.0.0.0:5005")
            .Build();

        host.Run();
    }

You can now run your app by running the yourapp.exe file in your publish directiry.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.