开发者

Why won't the debugger update?

开发者 https://www.devze.com 2022-12-30 08:29 出处:网络
Ive had this problem multiple times and it ruins my projects, I make some changes, like say I have a button in the top left corner of the form and move it to the top right corner, then I press debug b

Ive had this problem multiple times and it ruins my projects, I make some changes, like say I have a button in the top left corner of the form and move it to the top right corner, then I press debug but nothing happens to the form, it doesn't change the button is still in the top left-hand corner instead of the top right, and it also doesn't except any new code, its like it saved the project right there an开发者_开发百科d won't move on. Does any one know why or had this problem before?

Please, Help!!!!

Additional Details: Compiler: Microsoft Visual C# 2008 Express Edition I once fixed this problem by rebuilding the solution, but its never worked again.


Hey, I got it fixed, I right clicked Form1 in the solution explorer, clicked properties and change the Build Action to none then back to Compile and it seems to be working.


In the Visual Studio settings under Projects and Solutions->Build and Run change the option On Run, when projects are out of date: from Never Build to Always Build

Tools > Options > Projects and Solutions > Build and Run > On Run, when projects are out of date: "Always Build"


In addition to @SwDevMan81's answer with whom I agree, I would say that setting both the output and reference paths may help avoid such behaviour for class libraries. For instance, your application references a class library that you are currently writing, and you perform some changes to this referenced library, but the changes don't show.

What happens is that the compiler will copy localy (to the project's output directory) thereferenced DLL and as long as it is there, it won't get updated. You may verify it by clicking right on the referenced assembly, then clicking Properties. Look at the Filepath property. If you see it doesn't match your actual filepath, then you will have to make sure to set the reference path accordingly in the project properties, then removing then removing the actual reference to add it where the actual build is, that is, where your class library output folder is set. So, whenever you regenerate your class library, your application gets the update automatically. Here's an example:

Application Project references : The ClassLibrary1.dll assembly.

Once you will generate your application, the ClassLibrary1.dll file will be copied to your application output directory. Let's suppose C:\Open\Projects\ApplicationProject1\Debug\bin. So, this directory will now contain the ClassLibrary1.dll file.

  1. You rewrite a method to behave completely differently;
  2. You regenerate the ClassLibrary1 assembly;
  3. You rerun your application (remember that the file already exists!);
  4. Ends up wondering why the changes didn't take effect? That is because your application referenced the cached assembly within its Debug\bin folder.

To workaround:

  1. Remove the assembly reference from your application project;
  2. Go to the project's properties and click the Reference Path tab;
  3. Browse to your ClassLibrary1 output folder, then open it;
  4. Your Reference Path property is now set for this library, then re-add the ClassLibrary1 assembly to your application project;
  5. Run once, stop running, and see if the Path property of your referenced assembly is still the same as the one in the project's Reference Path property;
  6. You're done (if everything worked fine). C:\Open\Projects\ClassLibrary1\Debug\bin\ClassLibrary1.dll

In the end, this might be the cause of your problem if your GUI Forms are part of a class library, and the solution I described should work.


SwDevMan81 and Tanner's answers didn't work for me.

However,

Build > Rebuild Solution

... did!


Had The Same issue. Build > Rebuild Solution also worked for me

0

精彩评论

暂无评论...
验证码 换一张
取 消