Visual Studio 2005不会在发布配置模式下编译

时间:2023-01-06 11:48:56

SUMMARY: How to compile in Release mode...I cannot get it to "take" what I want to do.

摘要:如何在发布模式下编译...我无法让它“接受”我想要做的事情。

I have a webservice project in VS2005 C# that I am trying to optimize. One of the things I've had my awareness raised on is the recommendation to compile in Release mode. I am not sure what to expect here but here is what I am seeing:

我在VS2005 C#中有一个web服务项目,我正在尝试优化。我提出的意识之一是建议在发布模式下编译。我不确定在这里会发生什么,但这是我所看到的:

I rightmouse on the project and choose Properties and then the Build tab I click the Configuration dropdown box, set to RELEASE and notice that Output Path is \bin I click REBUILD on the project and the DLL goes into the \bin\debug folder (not \bin)! Here is a snippet pasted from the output window on that compile (note it shows the configuration as "Debug Any CPU" and later /define:DEBUG;TRACE):

我右键单击项目并选择Properties然后选择Build选项卡我单击Configuration下拉框,设置为RELEASE并注意Output Path是\ bin我单击项目上的REBUILD并且DLL进入\ bin \ debug文件夹(不是\ BIN)!这是从该编译的输出窗口粘贴的片段(注意它将配置显示为“Debug Any CPU”以及稍后/ define:DEBUG; TRACE):

------ Rebuild All started: Project: TRIMBrokerService, Configuration: Debug Any CPU ------
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE 
/reference:"C:\Program Files\Microsoft WSE\v3.0\Microsoft.Web.Services3.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll 
/reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.EnterpriseServices.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Mobile.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:..\TRIMBrokerUtilities\TRIMBrokerUtil\bin\Debug\TRIMBrokerUtil.dll 
/debug+ /debug:full /optimize- /out:obj\Debug\TRIMBrokerService.dll /target:library FaultCode.cs FileService.asmx.cs Properties\AssemblyInfo.cs Properties\Settings.Designer.cs Settings.cs "Web References\ASMXwsTrim\Reference.cs"

Compile complete -- 0 errors, 0 warnings
TRIMBrokerService -> C:\Documents and Settings\johna\My Documents\Visual Studio 2005\Projects\WSE\TRIMBrokerPassingByteArray\TRIMBroker\TRIMBrokerService\bin\debug\TRIMBrokerService.dll
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

I've noticed that I can interact with the Build tab dialog and when I change the Configuration dropdown list box to Active(Debug) or just Debug then the Output Path changes to \bin\debug as one would expect but I cannot seem to get it to compile in Release mode. Is there a trick? I dread having to read up on the MSBuild documentation just to deploy my little web service as I think it is way more than I need at this point.

我注意到我可以与Build选项卡对话框进行交互,当我将Configuration下拉列表框更改为Active(Debug)或只是Debug时,输出路径将更改为\ bin \ debug,正如人们所期望的那样但我似乎无法获得它在发布模式下编译。有诀窍吗?我不得不阅读MSBuild文档只是为了部署我的小网络服务,因为我认为这比我现在所需的更多。

4 个解决方案

#1


Right-click on your solution and choose Configuration Manager.. Make sure "Active solution configuration" is set to Release. Then make sure the project(s) in the grid below are set to use the Release configuration.

右键单击解决方案,然后选择Configuration Manager。确保将“Active solution configuration”设置为Release。然后确保下面网格中的项目设置为使用Release配置。

Perhaps something was changed accidentally..

也许有些东西被意外改变了......

#2


In addition to Ryan's response, the configuration set on the Build tab of the project settings has no effect on the current build mode, this just allows you to modify the settings for this project on each configured build mode in one easy place.

除了Ryan的响应之外,项目设置的Build选项卡上的配置设置对当前构建模式没有影响,这只允许您在一个简单的位置修改每个配置的构建模式下该项目的设置。

You can also use the "Solution Configurations" dropdown on the default "Standard" toolbar that lists the solution configurations next to the "Debug" button and the "Solution Platforms" dropdown.

您还可以使用默认“标准”工具栏上的“解决方案配置”下拉列表,其中列出了“调试”按钮和“解决方案平台”下拉列表旁边的解决方案配置。

#3


I ran into the same bizarre issue with VS 2008. A project compiled in debug mode just fine but spitted out many error messages when in release mode. After days of try and error. I finally found the issue: some of the files having paths exceeded 260 letters. The reason it worked for debug mode because the word "debug" has 2 letters less than the word "release". It happened to cross the line of 260 letters in "release" mode. If you are like me having a long name for your nested project directories, watch out for this. The problem disappeared after I shortened the main directory name.

我在VS 2008中遇到了同样奇怪的问题。在调试模式下编译的项目很好,但在发布模式下会发出许多错误消息。经过几天的尝试和错误。我终于找到了问题:一些路径超过260个字母的文件。它适用于调试模式的原因是因为单词“debug”比单词“release”少2个字母。碰巧在“释放”模式下越过了260个字母。如果您像我一样拥有嵌套项目目录的长名称,请注意这一点。缩短主目录名后问题就消失了。

#4


If you've got the assembly going to bin\Debug ever, then someone has modified the project the wrong way. Anything using ASP.NET needs to have the assemblies go to bin.

如果您已经将程序集转到bin \ Debug,那么有人以错误的方式修改了项目。任何使用ASP.NET的东西都需要让程序集转到bin。

#1


Right-click on your solution and choose Configuration Manager.. Make sure "Active solution configuration" is set to Release. Then make sure the project(s) in the grid below are set to use the Release configuration.

右键单击解决方案,然后选择Configuration Manager。确保将“Active solution configuration”设置为Release。然后确保下面网格中的项目设置为使用Release配置。

Perhaps something was changed accidentally..

也许有些东西被意外改变了......

#2


In addition to Ryan's response, the configuration set on the Build tab of the project settings has no effect on the current build mode, this just allows you to modify the settings for this project on each configured build mode in one easy place.

除了Ryan的响应之外,项目设置的Build选项卡上的配置设置对当前构建模式没有影响,这只允许您在一个简单的位置修改每个配置的构建模式下该项目的设置。

You can also use the "Solution Configurations" dropdown on the default "Standard" toolbar that lists the solution configurations next to the "Debug" button and the "Solution Platforms" dropdown.

您还可以使用默认“标准”工具栏上的“解决方案配置”下拉列表,其中列出了“调试”按钮和“解决方案平台”下拉列表旁边的解决方案配置。

#3


I ran into the same bizarre issue with VS 2008. A project compiled in debug mode just fine but spitted out many error messages when in release mode. After days of try and error. I finally found the issue: some of the files having paths exceeded 260 letters. The reason it worked for debug mode because the word "debug" has 2 letters less than the word "release". It happened to cross the line of 260 letters in "release" mode. If you are like me having a long name for your nested project directories, watch out for this. The problem disappeared after I shortened the main directory name.

我在VS 2008中遇到了同样奇怪的问题。在调试模式下编译的项目很好,但在发布模式下会发出许多错误消息。经过几天的尝试和错误。我终于找到了问题:一些路径超过260个字母的文件。它适用于调试模式的原因是因为单词“debug”比单词“release”少2个字母。碰巧在“释放”模式下越过了260个字母。如果您像我一样拥有嵌套项目目录的长名称,请注意这一点。缩短主目录名后问题就消失了。

#4


If you've got the assembly going to bin\Debug ever, then someone has modified the project the wrong way. Anything using ASP.NET needs to have the assemblies go to bin.

如果您已经将程序集转到bin \ Debug,那么有人以错误的方式修改了项目。任何使用ASP.NET的东西都需要让程序集转到bin。