C# 如何在 Visual Studio 2012 中构建 .exe

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14097598/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 10:39:21  来源:igfitidea点击:

How to build .exe in visual studio 2012

c#

提问by walking

I used visual studio 2012 to create project and now i want to build that project to .exe file. what do i must do?

我使用 Visual Studio 2012 创建项目,现在我想将该项目构建为 .exe 文件。我必须做什么?

回答by Habib

If it's a Console applicationor Winformor WPFapplication then you will get the executable by just building the application and it will be in your yourApplicationPath/Bin/Debug

如果它是控制台应用程序WinformWPF应用程序,那么您只需构建应用程序即可获得可执行文件,它将在您的yourApplicationPath/Bin/Debug

EDIT(Based on the comment)

编辑(基于评论)

You have to rephrase your question.You need to see that:

你必须重新表述你的问题。你需要看到:

Visual Studio setup projects (vdproj) will not ship with future versions of Visual Studio

Visual Studio 安装项目 (vdproj) 将不会随 Visual Studio 的未来版本一起提供

The Visual Studio setup projects will not ship again – Visual Studio 2010 was the last release with support for it. So, you'll want to make plans to migrate to something else. Of course, I'd suggest looking into WiX, and there are other options as well. The MSDN page Choosing a Windows Installer Deployment Toolcontains a table showing a comparison of VS setup projects, WiX, and InstallShield Limited Edition.

Visual Studio 安装项目将不再发布——Visual Studio 2010 是支持它的最后一个版本。因此,您需要制定迁移到其他地方的计划。当然,我建议研究 WiX,还有其他选择。MSDN 页面选择 Windows Installer 部署工具包含一个表格,其中显示了 VS 安装项目、WiX 和 InstallShield 限量版的比较。

回答by John Woo

The executable is built every time you run the project. You can find the EXEon the bin\debugfolder located on your project folder.

每次运行项目时都会构建可执行文件。您可以EXEbin\debug位于项目文件夹中的文件夹中找到 。

..SolutionName\ProjectName\bin\Debug\

but if you mean that you want to create a Setup Fileor MSI(or installers), please see the article below

但如果您的意思是要创建一个Setup FileMSI或安装程序),请参阅下面的文章

回答by Matt Clark

Every time you compile and run your application, it creates an EXE which can be found in the following location:

每次编译和运行应用程序时,它都会创建一个可以在以下位置找到的 EXE:

/path/to/project/bin/debug/myApp.exe

/path/to/project/bin/debug/myApp.exe

Within the menus of VisualStudio there is also an option toExport your project, which will build it to a specified path, as well, there is an option for creating an installer package if you so desire.

在 VisualStudio 的菜单中,还有一个用于导出项目的选项,这会将它构建到指定的路径,此外,如果您愿意,还有一个用于创建安装程序包的选项。

回答by urlreader

does it have "Build" under Menu? if not, go to "tools"->"setting", choose "expert", then you should be able to see it now.

菜单下有“Build”吗?如果没有,请转到“工具”->“设置”,选择“专家”,那么您现在应该可以看到它了。

回答by Mitch

Select "Release" first from the Solution Configurations drop down box, otherwise your compiled/distributed executable will still be in debug mode. Not only does this effect performance but it has other negative effects.

首先从解决方案配置下拉框中选择“发布”,否则您编译/分发的可执行文件仍将处于调试模式。这不仅会影响性能,还会产生其他负面影响。

Next go to the Build menu tab and select Build Solution (or press F6).

接下来转到“构建”菜单选项卡并选择“构建解决方案”(或按 F6)。

Then find your folder with your project and navigate to: yourproject\bin\Release\

然后找到你的项目文件夹并导航到:yourproject\bin\Release\

To fully Publish your program, select Publish from the Build tab and follow the Wizard. A Setup.exe will be created.

要完全发布您的程序,请从“构建”选项卡中选择“发布”并按照向导进行操作。将创建一个 Setup.exe。