I found some code to help me in a project and when I first ran the code I received an error message indicating: “Visual Studio cannot start debugging because the debug target c:\path\’dirInfo.exe’ is missing. Please build the project and retry, or set the OutPath and AssemblyName properties appropriately to point at the correct location for the target assembly.”
Then I select OK and receive an error message indicating that partial is missing. I add partial to the code and receive 3 more error messages.
-
The type ‘RecursiveSearchCS.Form1’ already contains a definition for ‘components’
- does this mean I should delete this from the Form1.cs file?
-
Type ‘RecursiveSearchCS.Form1’ already defines a member called ‘Dispose’ with the same parameter types.
-
Type ‘RecursiveSearchCS.Form1’ already defines a member called ‘InitializeComponent’ with the same parameter types.
(I notice, when I comment out the InitializeComponent line and/or Dispose line, many more error messages populate in ERRORS)
By they way you can find the original code @ MicrosoftSite.
Any help would be greatly appreciated.
Thank You
Just gut instinct, if you were following along and copy pasting remember one key thing:
The designer creates two files when you create a form: A “code” file, and a “designer” file. However, when microsoft (and others) release “templates”, they like to merge these two files.
Just create a new .cs file and paste the code and all should be good. It’s the code basically saying “in the designer, we already have this stuff”. (a good way to note this is the “partial” keyword located before your
Form1declaration)More info:
The Code file will house all your own implementations. That is click events, methods you personally override, events you bind to, etc. This is the default file when you select “View Code” from either your solution explorer or the dialog itself. Within this file is a construct that calls a “hidden” method, (
InitializeComponent) that if you right click and “Go to Definition” will bring you to the next file:The Designer file is the IDE’s generated file. This takes everything you do in the designer and stores it for you. That includes new controls, location and properties of the controls, and the
IDisposableimplementation. The idea is to keep the “meat an potatoes” out of the way while you worry only about implementation.