本文介绍了切换到任何 CPU 配置后,Win Service 项目将不会构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解决我的问题.将我的 .net 4.0 C# Win Service 项目更改为 Any CPU/Release 构建配置后,我收到此编译时错误:

I'm trying to find a fix for my problem. After changing my .net 4.0 C# Win Service project to Any CPU/Release build configuration, I am getting this compile time error:

如果构建模块或库,则不能指定/main

它将有问题的文件标识为CSC",生成它的项目是我的服务项目(不是解决方案中随附的代码库).我已经查看了项目文件和配置编辑器设置,但仍无法确定问题的根源.

It identifies the offending file as "CSC" and the project generating it is my Service project (not my accompanying code library in the solution). I've looked through the project file and configuration editor settings yet haven't been able to identify the source to my problem.

还有其他人遇到过这个节目停止问题吗?

Anyone else ever experience this show stopping problem?

推荐答案

已修复!如果其他人遇到这种奇怪的构建行为,我将提供解决方案.我在 MSDN 上找到了一个 论坛主题 有解决问题的方法.在项目文件中,我删除了 标记之间的值并将其留空.现在构建成功,没有之前的错误.

Fixed! I'll include the solution in case anyone else comes across this strange build behavior. I found a forum thread on MSDN that had the solution to the problem. In the project file I removed the value between the <StartupObject> tags and left it blank. Now builds successfully without the previous error.

这篇关于切换到任何 CPU 配置后,Win Service 项目将不会构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 15:01