A programmer has written a C # program. I change text messages, compile (using Visual Studio; F5), but they do not always change. For example, the text was:

  MessageBox.Show ("File" + temporary + "is not in the list of allowed files"); 

I changed it to:

  MessageBox.Show (temporary + "failas nerastas tarp leistinų failų."); 

The text changes in Visual Studio and the .cs file, but the program itself does not change. Changes after restarting the PC and another compilation. What is the problem?

  • Specify where you take the executable file of the program itself? Have you exactly recompiled it? There is a suspicion that F5 only restarts the application from the development environment, but does not fully build an exe file for the end user. Especially if the application is installed through the installer (.msi or whatever is popular there). - Nick Volynkin
  • @NickVolynkin, I open the project "launcher.sln", go to the file "Form1.cs", change the text and press F5. F5 in Visual Studio means Run, slightly to the right is selected "Release". The file is created by "\ launcher \ bin \ x86 \ Release" - ES.
  • Yeah, from this description can already be understood. I’m sorry, I don’t have a studio, but in general there are a lot of Sharpists here, they will probably answer) - Nick Volynkin
  • tried to rebuild before running? What does the task manager say - the process of your launcher does not remain in memory after closing? What does the studio write in the compilation logs? It seems that the executable file is locked with something (antivirus?) And cannot be changed during the compilation process. - rdorn
  • @rdorn, rebuild did not try. The process does not hang. When compiling it writes that it loads some libraries. starts the program later. No errors and warnings. I do not know how, but the problem was solved by itself. Now, after each modification of the text, it changes in the program - ES.

1 answer 1

Perhaps the problem is in one of the features of the studio, I don’t know if it’s a bug or a feature, but it ruined some of my nerves in my time.

Entry conditions:
In VS, a project is opened on a link from the list of the most recently opened projects from the main page of the studio or by clicking on the file someProject.sln .

Case One:
User Response:
From the menu open-> project or by clicking on the file otherProject.sln in the folder open any other project.
Studio Reaction:
The project opens in a new studio copy, everything is fine, the behavior when compiling and running is expected.

Case two:
User Response:
Through the menu open-> file or by clicking on the file in the folder open someFile.cs .
Studio Reaction:
The file opens in a new tab of the editor, regardless of whether the file belongs to an already open project or not. And this is sometimes bad.

For example, you can open a file whose name matches one of the files of an open project or open a file from a copy of a project. At the same time, this file, alien to the project, is neither visually different, and the presence or absence of errors in it does not affect the compilation process, since he does not participate in it, nor on the result of the compilation, for the same reason. A simple way to calculate the twin is to close all tabs altogether and open the ones you need through Обозреватель решений .

In general, the studio does not really know how to work with single files, I would say, it does not know how at all, only with projects and all the accompanying attributes. Therefore, after the opening of the project, I strongly recommend using only the Обозревателем решений to open source files.