.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to set different references in debug and release mode

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :.NET Framework
I have a C# application end a C# assembly. I can compile both in release and debug version. In the C# application I'd like to refer the release assembly version in release mode and the debug version for the debug.
Is it possible? In VS 2005 you have just one list of references for both release and debug.

View Complete Post

More Related Resource Links

References in debug vs release mode



I am developing a web site in Visual Studio 2008. I have a project for the web application and several class libraries as references. When I add the references I select the file under bin/debug in the class library folder. When changing the project to release mode the references still point to the .dll in the debug folder. Shouldn't this change automatically. How should I add the references so that debug and release are properly referenced?

Best regards, Janhe

How to figure out if package runs in debug mode

Hi, I would like to know whether there is a possiblity to dynamically determine at runtime if a script is runing in debug mode or is being executed via SQL Server Agent? My goal is to prompt the user with some information e.g. initial catalog ensuring the package is being ran in the correct environment (development/production). However, as SQL Server Agent does not support MessageBoxes I would like to write some alternative code in this case. Thanks in advance!

DTExec is MUCH slower that just running my package in Debug mode in BIDS 2005

I am using BIDS / SSIS 2005.  I have a large package that runs very smoothly and fairly quickly when run in debug-mode through BIDS.  When I actually deploy the package to SSIS and execute it using either DTExec or DTExecUI it is WAAAAYYY slower than when run from the development environment.  So slow that I become convinced it is hanging on steps that execute very very quickly in BIDS.  I have read this thread -> http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/5585fa13-dd15-4406-9d4a-e993f2af5929 which has not helped. I understand that DTExec would be faster than DTExecUI because the former does not have to deal with the GUI component but I would have expected both (and especially DTExec) to be faster than running in debug from BIDS. I realize I am not providing a ton of detail here, problem is I just don't know where to start... any advice on what I should be looking at to improve package execution through DTExec and / or DTExecUI would be greatly appreciated.  Why would DTExec be so much slower than BIDS Debug??? Thanks in advance.. - Charles

Hit counter not updating except in debug mode

I have a webcast site that lists them in a gridview. Users have two options, either play the video directly or go to a details page on it and play from there.  When the user plays the video directly I need to update the count of how many times it has been viewed.  When I run the page from my local machine in debug mode it correctly updates the counter.  When I run the page regularly, both from my local machine and on the server it does not update the count, but it does open and play the video.  It doesn't give any error messages in any method of running.  The only difference between running it on my local machine vs production server is that I have to comment out the authentication code on my local machine.  The authentication programming was created by someone else with far more knowledge and I only barely understand how it works.  For that matter this site was originally created by that same person.  He included the hit counter on the details page but forgot to add it on the front gridview page, so I'm modifying it based on his code on the second page. Important parts of code behind and part of the gridview listed below.  Yes I know the means of creating the first connection string is bizarre.  I think it has something to do with the authenticate files that makes it work.  In the past it has always worked fo

Debug and Release Buids

I have a solution containing a windows forms application and a class library.  The windows forms application has a reference to the class library project.  When I build the project, it fails to find the class library output.  Looking closer at this, it appears that VS.NET is looking for the debug build, but the class library has been built in release mode.Since I have no idea how to switch between debug and release (used to be a toolbar option) I would have assumed that since I must be in debug mode, VS.NET would have built both in debug mode and no problems.  So why has it built my class library in release mode and attempt to build my forms application in debug mode, then fail because it can't find the debug version of the class library?Help much appreciated.

"Failed to grant minimum permission requests" when building release mode dll

Hi there,I have started to receive a  release mode build failure for which I  would appreciate some advice. The build works fine in debug but sgen fails in release when a dll that contains a web-reference is linking to a c++\cli dll on the network. The debug build links to the same (release mode) c++\cli dll without this problem.I believe this has started since adding the web-reference. Any idea what the work around is?Many thanks.Duncan4>C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\sgen.exe /assembly:"C:\Projects\Forecaster\Source 2.0\GH.Forecaster.IO\obj\Release\GH.Forecaster.IO.dll" /proxytypes /reference:S:\SoftwareUtils\Release\GH.Common\Release\Latest\GH.Common.Unmanaged.dll /reference:S:\SoftwareUtils\Release\GH.Common\Release\Latest\GH.Common.Util.dll /reference:"C:\Projects\Forecaster\Source 2.0\Release\GH.Forecaster.Data.dll" /reference:"C:\Projects\Forecaster\Source 2.0\Release\GH.Forecaster.Util.dll" /reference:S:\External\log4net-1.2.10\bin\net\2.0\release\log4net.dll /reference:"C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit.framework.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.EnterpriseServices.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2

_CrtIsValidHeapPointer(pUserData) getting thrown in debug mode, /clr Forms project calling custom na

I'm working on a native DirectX11 project where I'm trying to use Windows Forms as a GUI for myself to modify things in the visual environment. I know the native static libraries are stable and not walking through memory since I have an .exe that can run it externally from the clr Form project. _CrtIsValidHeapPointer(pUserData) is getting thrown at runtime and I can see that this has alot to do with atexit and _onexit being called. The stack trace that directly relates to my code looks like the following: > HogsheadEd.exe!`dynamic initializer for 'Hogshead::Core::ResourceLibrary::_prototypes''()  Line 7 + 0x32 bytes C++ This line in code is a static member in a cpp: Vector<IResource*> ResourceLibrary::_prototypes; where Vector<type> is a static instance of custom templated class in one of my native static libraries, IResouce is a pure virtual class, and ResourceLibrary is essentially a singleton with all static members and methods. I've done alot of searching and http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/62db4002-4ebc-4a3a-91ec-9fc702db821e/ appears to be very similar to my problem yet anything I try mentioned there does not work for me. I am using Visual Studio 2010 and to be honest I do not know much about debug symbols. This seems to be a solved problem from what I'm

Release mode application throws Break instruction exception - code 80000003 when running in WinDbg


Here is the initial output of my program after running it from WinDbg:

CommandLine: "C:\Documents and Settings\Administrator\My Documents\Work\QMI_Test_Tool\QMI_UT_Source\Release\QMI Validation Tool.exe"
Symbol search path is: SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
Executable search path is: 
ModLoad: 00400000 0048f000  QMI Validation Tool.exe
ModLoad: 7c900000 7c9b2000  ntdll.dll
ModLoad: 79000000 7904a000  C:\WINDOWS\system32\mscoree.dll
ModLoad: 7c800000 7c8f6000  C:\WINDOWS\system32\KERNEL32.dll
ModLoad: 77dd0000 77e6b000  C:\WINDOWS\system32\advapi32.dll
ModLoad: 77e70000 77f03000  C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77fe0000 77ff1000  C:\WINDOWS\system32\Secur32.dll
ModLoad: 7c420000 7c4a7000  C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\MSVCP80.dll
ModLoad: 78130000 781cb000  C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\MSVCR80.dll
ModLoad: 77c10000 77c68000  C:\WINDOWS\system32\msvcrt.dll
ModLoad: 7c9c0000 7d1d7000  C:\WINDOWS\system32\SHELL32.dll
ModLoad: 77f10000 77f59000  C:\WINDOWS\system32\GDI32.dll
ModLoad: 7e410000 7e4a1000  C:\WINDOWS\system32\USER32.dll
ModLoad: 77f60000 77fd6000  C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 7c4c0000 7c53d000  C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\m

Deploy in Release Mode


Hi I'm developing a web application in VS2008 (VB.Net).


How do I set configuration to Release mode?

I followed this thead and was able to display configuration DropDownList. But it is disabled.



Thanks for the help!!


Exception Handling: StackFrame Capture not capturing last level method call in release mode


I am trying print the exception details frame by frame along with other debug info (code below). In the code as you can see the DummyCall3 throws and ApplicationException and the expectation is that the stack trace will have information regarding DummyCall3. Below are the behavior I am getting with .NET 4.

  • Using the "Debug" build, when I run it, I get expected results (DummyCall3 > DummyCall2 > DummyCall > RunTest)
  • Using the "Release" build however, the DummyCall3 method is somehow missing from the stack trace. Now I only get (DummyCall2 > DummyCall > RunTest)
  • I add a dummy statement in the DummCall3 method before I throw the exception, and rerun using "Release" mode and now it works as expected with strack trace info (DummyCall3 > DummyCall2 > DummyCall > RunTest)
  • If I switch the framework version to .NET 3.5 it works as expected in both Release and Debug modes?

I would like to know if this behavior is by design or a bug? if it is by design, what was the reasoning behind it. Appreciate any input on this.


  class StackFrameTest
    public void RunTest()

How to run Scripts in Debug mode to run queries step by step in Sql Server 2008


Hi all

i am working on SQL Server 2008 i dont know to how to use the debuging mode to Run Scripts

so that to check Scripts step by Step  please help me out i am wasting my time for checking the error please provide me any link that provides article & Demonstration

thanks in Advance

Sunil Yoganna

Visual Studio 2005 won't enter debug mode.



I am developing asp.net 2.0 using c# and when I place a break point on a line of code and hit f5 or "start debugging" it just brings up the website without stopping at the breakpoint.

 It is set for debug not release and I don't know what else to do? Does anyone have any suggestions?



"Release" folder vs. "Debug" Folder. What is the impact & how to do it.


Hi Folks,

I have few questions regarding Debug vs. Release mode.

1) How to compile a application so that it lands in "Release" folder vs. "Debug" Folder.& how to do it. What is the impact or difference between Debug vs. Release mode

I ask this question for C++ & C-sharp applications/dlls.

2) Also, Can I used "Release" mode Reference dlls in an Application which itself is going to be complied in Debug mode.

Thank you


Turn ON Custom Error and disable debug mode



We have a ASP .Net based web service setup and hosted on a IIS v6.0. We wish to turn on custom error and disable debug mode. I understand these can be accomplished by modifying the web.config and machine.config file. However, since web service does not have a UI...please let me know if the changes made to the config files will take into effect. The reason why we wish to do these changes is because, our external auditors have flagged these as a vulnerabiity.



Venkatesh Selvaraju

Dynamically Set Web Reference based on DEBUG and RELEASE modes

I ran into a problem today that took me a while to figure out (for the second time) and wanted to post it since I'm sure I'm not the only one to want to accomplish this. The problem is, I reference a web service from my application but the web service I want to use is on a different server than the one used in the production environment. Specifcally, I wanted to be able to run my web service on my local machine without having to manually change my web reference back and forth between the production URL and my localhost URL and risk forgetting to point it back to the correct server before releasing an update to production. Here's what I did to accomplish that:

  1. Set my Web Reference URL to my local URL in the properties window.
  2. Set the Web Reference URL Behavior to Dynamic. This lets the URL to be read from the project's AppSettings at runtime.
  3. Now that we're using the AppSettings as our URL, we can set that value at runtime as long as our setting is scoped at the User level and not the Application level. In the project, I opened Properties>Settings.settings and for the row with my Web Reference URL , changed Scope to User.
  4. From that window you can click the View Code button to open Settings.cs. I added this code to the constructor though, you could update the setting value elsewhere if needed:


Is there any way to run ad-hoc sql queries from within SQL CLR debug mode?


I'm picturing a Management Studio query window type of interface, but inside of Visual Studio.  I'm pretty sure it doesn't exist, but want to ask to confirm before putting in a feature request.  The reason it's needed is that when working with triggers in SQL CLR, the Inserted and Deleted tables are essential to the functionality, but cannot be accessed from Management Studio.  That makes debugging really tough when a query does not yield the expected results, because similar queries can't be easily plugged in and executed.

Also (a related comment / question / request), is it contemplated to make the SQL CLR functionality more fault tolerant?  Once ANY exception is thrown, NO further queries can be executed.  That also makes it really difficult to debug when a query isn't working right, as it requires countless re-executions of the code to diagnose the issue.


Rendering ASP.NET Script References into the Html Header

One thing that I've come to appreciate in control development in ASP.NET that use JavaScript is the ability to have more control over script and script include placement than ASP.NET provides natively. Specifically in ASP.NET you can use either the ClientScriptManager or ScriptManager to embed scripts and script references into pages via code.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend