visual studio 2010 unable to start program .dll

2019-03-24 09:05发布

问题:

I have a problem for my visual studio 2010. When I click start debugging button and it's start debugging.

It seems that there is no error "i just create one "button" on it "

But it will show Unable to start program 'c:\users\.....\xx.dll'

Does someone now how to solve it?

The second question is: when I click left button to see the "Button" source code, why it will show all this project code? Should I revise some setting?

回答1:

Visual studio will not run a .dll by itself. does your solution have an .exe project? if so, right click it and select "Set as Startup Project". if not you will need to create one, and instruct it to load the forms within your dll.

as for left clicking the button, I'm not quite sure what you are describing. can you post a picture?



回答2:

In earlier versions of MSVC while running .dll, will get a dialog asking path for .exe file

But in MSVC 2010 and above there is no such option. To fix this

  1. Right click on your dll project
  2. Properties
  3. Configuration Properties > Debugging. Here, in Command -> add path to your exe.

Add command arguments, if any.

You are good to go!