Error Message: debug target...is missing

R

ryguy7272

I copied the following code from a book about C# programming:
public class Portfolio
{
Stock[] stocks;
public Portfolio (int numberOfStocks)
{
stocks = new Stock [numberOfStocks];
}

public int NumberOfStocks { get { return stocks.Length; } }

public Stock this [int index] // indexer

{
get { return stocks [index]; }
set { stocks [index] = value; }

}
}

class Test
{
static void Main( )
{
Portfolio portfolio = new Portfolio(3);
portfolio [0] = new Stock ("MSFT", 20, 1000);
portfolio [1] = new Stock ("GOOG", 300, 100);
portfolio [2] = new Stock ("EBAY", 33, 77);

for (int i = 0; i < portfolio.NumberOfStocks; i++)
Console.WriteLine (portfolio.Symbol);
}
}

When I run the code I get an error message: Visual Studio cannot start
debugging because the debug target...path on my
laptop\ConsoleApplication1.exe...is missing. Please build the project and
retry.
If I click Debug > Build Solution and hit F5 I get the same message. What
do I need to do to make this code work?
Thanks!!
Ryan---
 
M

Mike Lovell

When I run the code I get an error message: Visual Studio cannot start
debugging because the debug target...path on my
laptop\ConsoleApplication1.exe...is missing. Please build the project and
retry.
If I click Debug > Build Solution and hit F5 I get the same message. What
do I need to do to make this code work?

This is usually one of two things, either the Start up object is missing
(Right click on the project, go to properties, check it out)

OR

There's a problem with the output path, look in properties | Build | Output
path

Does your project even build (without errors)? If not, perhaps it could be
trying to run the last successful build (which might not exist)?

Was your project created as a Console project, or just an empty one?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top