Share via


Visual Studio 2017 Stand Alone app - How do I create an EXE

Question

Wednesday, July 4, 2018 7:28 PM

I am new to Visual Studio and C% programming.  So, thanks in advance for your assistance.

I have a simple stand alone app that I want to create an .EXE for.  I have searched the NET and haven't found any guidance for Visual Studio 2017.  I have tried building the standalone app, then look in the bin directories and I don't see an executables created.  Not in the debug directory or anywhere else.  I have seen comments that you need to go set project properties but the screens are in earlier versions and I don't see the same settings in 2017.

Thanks for your help.

Chris

All replies (6)

Thursday, July 5, 2018 6:03 AM ✅Answered

Hi,

What's the type of your project?

If your application is a Windows Forms, Console or WPF project...., it is created as soon as you build your project.

If you create a .NET Core console application, have a look at the case:

https://stackoverflow.com/questions/44201334/visual-studio-2017-missing-exe-file

There is no exe file because you created a .NET Core application. 

You have two options:
1.If you want an EXE, you need to target the .NET Framework.
2.If you don't want to change your code, then you need to install .NET Core on the server and run dotnet pathToDll on a command line

Best regards,

Joyce

Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].


Thursday, July 5, 2018 9:23 PM ✅Answered

I think you will have to recreate the project using the correct project.

If you use the .NET core templates, it will only allow you to choose between the .NET core runtimes. The only way I could see to fix this is to recreate the project using one of the Windows Desktop templates, only then could I change between the regular runtime and have it produce an executable.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.


Wednesday, July 4, 2018 7:38 PM

There are tutorials in MSDN, like :

Tutorial 1: Create a picture viewer

where you can follow the steps

or

Build a C# Hello World application with .NET Core in Visual Studio 2017

etc...


Thursday, July 5, 2018 8:32 PM

Joyce,

Thank you for your reply.  I am admittedly very very new to C# and thank you for your assistance.

I am attempting to modify an application for a friend of mine.  The vendor provides templates and I have always seen that the provide EXE's rather than .DLL's.   

That being said.  The properties for this project are:



This seems to indicate that the Target Framework is .NET Core.

If I click on the drop down box,  I simply see a list of other .NET (1.0, 1.1 and 2.0) core frameworks.

I see as you mention that the build is producing a .DLL

What would I need to do in order to switch this project so that it would produce an EXE rather than a DLL?

I am not familar with dotnet run...  However, it looks like this article spells out what I need to do.

https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-run?tabs=netcore21 

Many Thanks, Chris


Friday, July 6, 2018 8:33 AM

In Visual Studio 2015 go to File -> New -> Project -> Windows -> Console Application -> Give Name as : Test1, Give Location path :D:\MVCDinesh\EntityFramworkMVC\ -> Ok.
Write below code in Program.cs file:

using System;
namespace Test1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("This is for testing purpose !");
        }
    }
}

Save Program.
Check below location: D:\MVCDinesh\EntityFramworkMVC\Test2\Test2\bin\Debug
You will Find the following 5 files:

  1. Test1.exe: It is not an executable file. It is just Test.exe.config file. If you want to check, then right click on this file -> go to Property.
  2. Test2.pdb
  3. Test2.vshost
  4. Test2.vshost.exe
  5. Test2.vshost.exe.manifest
    Now Go to 'Build' option -> Select 'Build Solution'
    Check below location: D:\MVCDinesh\EntityFramworkMVC\Test2\Test2\bin\Debug
    Now, Test1.exe is created.

Friday, July 6, 2018 4:58 PM

Thank you very much.

I recreated a new shell for the project,  pasted in my code, rebuilt the project and now I have an EXE.  

Thank you everyone for your input.

Chris