In a Visual Studio (Professional 2017) solution, I have multiple projects, two of which are startup projects, the UI
and the API
. The curious thing is that the API\Global.asax.cs
does not seem to be executed, although both startup projects are actually enabled to be launched for debugging. I am sure about that, since when hitting the green Debug arrow, two browser windows open, and both UI and API work.
There are two distinct Global.asax.cs
-files, one for each startup project (whether that is a sensible design, I don't know - I took over the solution this way). Within the one for the API, breakpoints are not working, more specifically VS says:
The breakpoint will not currently be hit. A copy of Global.asax.cs was found in UI.dll, but the current source code is different from the version built into UI.dll.
To allow this breakpoint to be hit: right-click on the breakpoint, choose either 'Conditions...' or 'Setting...'. Then chcoose 'Location', 'Allow the source code to be different from the original.'
To allow this for all breakpoints, disable the option 'Required source files to exactly match the original version' under Tools, Options, Debugging, General.
The full hover-over-breakpoint-message looks as follows:
Following the last suggestion did not change anything. Concerning the first suggestion, I do not have the options to choose in the context menu under Conditions
.
I cannot inquire to much about the solutions's architectural background, that is why I am
asking here for help: I am assuming that the error message also means that the file API/Global.asax.cs
is not read at all, or is that conclusion wrong?
More importantly: How do I ensure that API\Global.asax.cs
is read/ executed?
Differently put: When is it supposed to be executed when in debug mode? I have the impression, it executed every now and then since I see debug-output in my VS-Output window sometimes - I did not manage to guess when it is executed.
Edit: Further Background
In in the Solution Property Pages (right-click on the solution and choose Properties), there is the option Multiple startup projects chosen. The API
project is in the list before UI
.
Under Project Dependency is specified that the API
project depends on different other projects, but not the UI
project. The other projects have some inter-dependencies as well, but none of them depends on the UI
project. The UI
project does not depend on any other project, either.