How do I Compile my Program?

Leopardfist

Member
Joined
Nov 25, 2014
Messages
14
Programming Experience
Beginner
I am just learning C#, I used to mess around in C and C++ maybe 10 years ago, maybe less, but its been awhile.

So, I been studying C#. I have been working on a program, and it is a C# program in a WPF template. I got it to a point now, where I want to compile it to an .exe so I can copy it to my working dirctory and test it. However, when I choose Release instead of debug, and I build it, the exe created in the release folder in the bin folder would not work on my XP machine. It also had about 5-7 other files. Can we not compile a C# program to one .exe file? Is it because it is wpf?

I am using VS2013 Express.
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,274
Location
Sydney, Australia
Programming Experience
10+
no, you cant. you can compile with setup project file. your other files will compile with this setup, its like make a installation. watch this, you can learn from it.
sorry if i'm wrong.
Create Setup and Deployment Of Wpf Application Step By Step with Visual Studio 2012 | Method ~ of ~ Tried
or
www.youtube.com/watch?v=cp2aFNtcZfk

Erwin Harry

Yes, you are wrong. Building and publishing are two different things.

When you build a C# WPF project it will create an EXE file. Whether that is the only file required depends on the project. You will need the config file if there are any values in it that you use, e.g. connection strings. There may be any number of other files required based on the situation.

As for why it doesn't work, there could be any number of reasons. The first one that comes to mind is that you don't have the required version of the .NET Framework installed. That's just a guess though. Would you expect a mechanic to fix your car based "it doesn't work"? How can we diagnose your application issues based on that information?
 
Top Bottom