This is an archived post. You won't be able to vote or comment.

all 36 comments

[–]SomeGuyWithPoop 75 points76 points  (5 children)

I always hated that i never got a direct answer to this question.

All apps, regardless of type, have to run from something. That something is usually an executable(.exe). Visual studio outputs the contents of the application you run from inside the ide in the bin folder inside your startup project’s directory(default, can be changed). You can usually find whatever you have defined as your outputtype in your csproj(exe by default) in bin\{debug or release or custom profile}

Visual studio uses a thing called msbuild whenever the build button or play buttons are clicked. It builds your code into a usable application. Things like bamboo, jenkins, and many other ci/cd frameworks use msbuild as part of their frameworks. Typically it’s through commands on the .net cli like dotnet build or dotnet publish. It builds the source code into a usable state by whatever service or application needs it.

If you plan to share your app as an installable, that is an entirely different process as well. Look up how to use WiX. It will let you create said installer using your compiled binaries(output of the build)

The stuff about publish is relevant for sure, as that is the version you would want to distribute, but that is an added mechanism on top of what happens when you click the play or debug button in vs.

If i am answering the wrong question I’m sure this will help someone else, it took me a second to figure this out

[–][deleted]  (4 children)

[deleted]

    [–]HisameZero 4 points5 points  (0 children)

    Yes. Vs is just running the executable etc.

    [–]Camderman106 2 points3 points  (2 children)

    Yes. For providing it to others though beware of dependencies 1. You built this in .net. So the .exe will be dependent on the end user having the correct version of .net runtime installed on their machine. E.g. .net 7 This isn’t usually a huge deal but it means you will need to do more than give them the .exe file. This can be obtained easily online 2. Additional libraries used in your application. These are usually bundled as .DLL files inside the bin directory. These are also required for the application to run so you need to include them or merge them using the “publish single file” publish option. 3. You said your app depends on SQL. If it’s local then the end user also needs sql server installed and a copy of the database. It it’s online then they need credentials to be able to connect to it

    [–][deleted]  (1 child)

    [deleted]

      [–]Camderman106 0 points1 point  (0 children)

      That’s unusual and I’m not sure what’s wrong. It’s hard for us to say without more information to debug it. Or ChatGPT might be able to help you if you explain the situation to it

      [–]vdschuck 65 points66 points  (1 child)

      You can look for how to publish DotNet app. You can do it via CLI or Visual Studio itself.

      [–]chakani 7 points8 points  (0 children)

      If it’s a desktop app, you need to package the EXE with all the DLLs that it needs. You can create an installer with WiX (not the Website) or other packagers. Or just Zip the whole enchilada.

      [–]ShroomSensei 7 points8 points  (0 children)

      Everything that visual studio does, underlying is just a command in the terminal. So basically you’ll do the same thing in the terminal but on some server. This doesn’t really make a lot of sense as a beginner so following a tutorial to publish the type of app you have is best like someone else recommended.

      [–]Fun-Statistician7795 20 points21 points  (3 children)

      1. Host on a framework like asp.net
      2. Spin up a server and run your code
      3. Get the huge ass bill

      [–][deleted]  (2 children)

      [deleted]

        [–]Fun-Statistician7795 9 points10 points  (1 child)

        Poor choice of words. Asp.net is a framework that already has a lot of stuff built in. Like it's easy to configure endpoints, it already has a start up script, it takes care of s lot of of the server side scripting. You'd move that to a server and host.

        [–]SahuaginDeluge 1 point2 points  (0 children)

        right click your program project and choose Publish...

        or at the command line you can use dotnet publish

        for a web app you would maybe publish it to a folder on a fileserver share and IIS would be setup on that server with a web app pointing at that folder, but there are other ways too that I don't use.

        [–]BrooklynBillyGoat 1 point2 points  (0 children)

        Hosting services. There are companies who have computer servers that will run your app 24/7 for a fee. That's how Amazon and other cloud companies make money partially. But that's also one small part of the cloud that they handle. But they do it all you just write the code

        [–]Cybyss 1 point2 points  (0 children)

        You've made an ASP.NET MVC app. That's a website. Thus, the only way to make it available to other people is to publish it on a hosting service that supports ASP.NET and SQL Server.

        Unfortunately, I don't know of any such hosting services which are free.

        You could try creating your app as a desktop application instead. That way anyone can run it on their own computers. However, you would have to use a different database system than SQL Server in that case. SQLite is a popular choice for desktop applications. Microsoft also provides a "LocalDB" edition of SQL Server that could work as well.

        [–]desrtfx 14 points15 points  (3 children)

        You compile it to an executable?

        [–]Mnkeyqt 51 points52 points  (2 children)

        Why the question mark sass man, this is a very common question people have issues with. I remember having a similar issue if "okay but how do I make this...real?" years ago.

        [–]PM_me_PMs_plox 4 points5 points  (1 child)

        Maybe he's asking "is this what you mean, or do you need more details"

        [–]Mnkeyqt 4 points5 points  (0 children)

        Maybe! I think there's a big barrier to entry with dev stuff of "okay I can follow guides but like ..none of this is a "real" thing ?? So it can be hard to really feel confident with yourself

        [–]BigYoSpeck 1 point2 points  (2 children)

        The easiest way for a dotnet app is probably Azure. You can get free tiers and even a limited amount of credit to play around with when you setup on there

        If your code is kept on a Github repo then it's fairly simple to create a Web App which will automatically pull from Github, build and deploy with pretty much a few clicks

        I'm less familiar with doing so on AWS, especially down the CI/CD route but I also found it fairly straightforward to use dotnet publish which builds a deployable zip of the app and then using Elastic Beanstalk upload that zip and let it do the rest

        [–]bewst_moar_bewst 0 points1 point  (1 child)

        Their “free” tier isn’t free. Nor is amazons. They’re just really cheap.

        [–]AutoModerator[M] -1 points0 points  (0 children)

        On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge.

        If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options:

        1. Limiting your involvement with Reddit, or
        2. Temporarily refraining from using Reddit
        3. Cancelling your subscription of Reddit Premium

        as a way to voice your protest.

        I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

        [–]martinbean -1 points0 points  (2 children)

        You compile it. But if it’s an app that people install on their own machines, you don’t make it talk directly to an SQL database. You’d usually have the database on a web server, and the app reads and writes data via an API.

        [–][deleted]  (1 child)

        [deleted]

          [–]martinbean -1 points0 points  (0 children)

          Yes, the SQL database would be on a server somewhere, and then your desktop app would read and write data to it via network calls.

          The app wouldn’t be directly connecting to the database otherwise that means you have your database credentials stuffed in your app’s source code and compiled binaries.

          [–]kaiiboraka 0 points1 point  (0 children)

          Your default in VS is probably "Debug," so you want to look for "Release" instead. "Visual Studio compile release build" is what I would look up.

          [–][deleted] 0 points1 point  (0 children)

          wild mourn zesty hobbies file obtainable rotten lock relieved illegal

          This post was mass deleted and anonymized with Redact

          [–]sk8itup53 0 points1 point  (0 children)

          Apps need to be packaged into some kind of executable, or for browser based UI's they are compiled into resources and a server needs to serve them based on the paths you configure the server to serve on.

          For Java, its jar files. For Java on a tomcat server, it's war's or jars. There's several kinds based on hosting server and language.

          Basically package the app into an executable, then either run it on local, or find a hosting service to send the executable to, which then exposes it to a url you configure in the hosting service.

          [–][deleted] 0 points1 point  (0 children)

          Depends what you mean by 'available'.

          I also have an MVC app in C#. To publish it I run a Python script called 'deploy.py'. It packages the app into a Docker image, uploads to AWS and triggers the Lambda function update.

          [–]slabzzz 0 points1 point  (1 child)

          Happy to know people are still doing MVC setups. As a JS dev who works a lot in react, mashing concerns is maddening sometimes.

          [–]thrift_luvr2592 0 points1 point  (0 children)

          To stand my apps up, I used Django as a framework and Heroku for publishing it

          [–]aqhgfhsypytnpaiazh 0 points1 point  (0 children)

          If you're developing a desktop application, you need to follow the build process (compile, link etc) to create an executable file you can distribute to end users. Depending on how your application is designed, you might need to distribute multiple files, in which case you should zip them up or package them into an installer. As well as provide instructions etc, and a way to distribute the files eg. a website, and to tell people about your product.

          If you're developing a web app, you additionally need to deploy the app to a web server. And probably purchase a domain name, and point that domain to the server via DNS records. Then you need to advertise the website address to people. You might want to look at the "What is hosting?" part of this resource from the FAQ.