在C#中构建Windows服务时,为什么我的二进制文件没有放在/bin/release文件夹中? [英] Why are my binaries not placed in the /bin/release folder when I build a Windows Service in C#?

查看:258
本文介绍了在C#中构建Windows服务时,为什么我的二进制文件没有放在/bin/release文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C#和VS 2010的新手,并且正在遵循有关在Visual Studio 2010中创建C#Windows服务的在线指南.

I am new to C# and VS 2010, and am following an online guide to creating a C# Windows Service in Visual Studio 2010.

但是,当我尝试构建应用程序时,没有在/bin/release文件夹下创建任何文件.

When I try and build the application however, I don't get any files created under the /bin/release folder.

我确实在/bin/Debug文件夹下获取文件.

I do get files under the /bin/Debug folder.

我尝试了所有构建配置,例如Active,DEBUG,Release,All,但没有任何更改.

I have tried all the build configurations e.g Active, DEBUG, Release, All but nothing changes.

我尝试关闭解决方案并重新启动等.

I have tried closing the solution down and restarting etc.

在其他一些C#控制台应用程序项目中,我也遇到了同样的问题.

I have also experienced this same problem on a number of other projects which have been C# console apps.

/bin/release文件夹存在(因为我必须手工创建它),并且我已经检查了属性"选项卡中的输出路径,以确保发行版配置针对该文件夹.

The /bin/release folder exists (as I had to create it by hand) and I have checked the output path in the properties tab to ensure the release configuration is targeted to that folder.

我在工作中问我们的"C#专家",他没有任何线索.有谁知道是什么原因造成的?

I asked our "C# guru" at work and he didn't have a clue. Does anyone know what could be causing this?

推荐答案

最有可能的是,您仅配置发布版本,而不是实际构建处于发布模式的项目.

Most likely, you are only configuring the Release build, not actually building the project in Release mode.

只需从工具栏的下拉框中选择发布"模式,如下图所示:

Simply select "Release" mode from the drop down box in the toolbar, as shown in pic below:

或者您可以从项目的属性"中执行相同的操作:

or you can do the same thing from your project's Properties:

然后,当您构建项目( Ctrl + Shift + B )时,它将在发布模式下构建并将输出放置在您在项目"属性中配置的文件夹. (通常是bin/release.)

Then when you will build the project (Ctrl+Shift+B), it will build in Release mode and place the output in the folder you have configured in Project properties. (Usually this is bin/release.)

如果您仍未在release文件夹中看到文件,则按照注释 Gishu 的建议,在构建过程中检查输出窗口",以查看实际在何处创建了二进制文件

If you still don't see files in the release folder then as suggested by Gishu in the comments, check the Output Window while the build is in progress to see where the binaries are actually being created.

这篇关于在C#中构建Windows服务时,为什么我的二进制文件没有放在/bin/release文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆