Solved

Why can't I add code to a C# project in Visual Studio 2008

Posted on 2010-11-29
6
308 Views
Last Modified: 2013-12-17
I have an intermittent problem with visual studio 2008.  I will work on a project for a period of time (not sure if length of time matters) but sometimes I will add code to a project and that code doesn't get incorporated into the project, it's there, it's saved, but it doesn't affect the behavior of the code.  

For example, today I have a project that is working, but I wanted to add a simple switch statement.  I added it, but the changes didn't appear in my results when I run the code in debug.  So I added a writeline statement inside the switch and still nothing.  I have encountered this behavior before and I have had to create a new project and paste the old code into it, at which time the changes are recognized.

Has anyone else encountered this?  Any idea how to fix?
0
Comment
Question by:rickmatt
6 Comments
 

Author Comment

by:rickmatt
Comment Utility
Also, I noticed that the new code is recognized if I switch from debug to release, but when I switch back to debug, the code is still there in the .cs file, but it doesn't get included in the run.
0
 
LVL 15

Accepted Solution

by:
crisco96 earned 250 total points
Comment Utility
I've never seen anything like this happen. Next time it happens try deleting your bin folder and rebuild and see if that fixes it. It almost seems like VS doesn't recompile the executable sometimes. Also double check that you don't have any compile errors when this happens.
0
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
You don't have any #if DEBUG blocks in there do you?
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 9

Expert Comment

by:TonyReba
Comment Utility
can you post your page first lines , that sounds kinda odd, have you rebuild the solution and right click into the code file to manually add???
0
 
LVL 6

Expert Comment

by:ajb2222
Comment Utility
Under the build menu, select rebuild solution then run it.  

0
 

Author Closing Comment

by:rickmatt
Comment Utility
Awesome, that worked.  I never considered deleting the bin/Debug directory before, and it's a tiny bit of a hassle, but much better than rebuilding the entire project as I had done before.

Thanks for the quick solution!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now