Unable to start program. [VALUE].dll is not a valid Win32 application error in Visual Studio 2017

I have developed an C#, ASP.NET web application in a Windows 7 machine using Visual Studio 2012. Now i had imported the entire project into VS 2017 running on windows 10 machine, and when i try to enter the debugging mode to analyze my code it shows the following error:

enter image description here

I guess the project configurations are conflicting hence it throws this error. Any suggestions??

4

7 Answers

The same error happens when Visual Studio solution has selected the wrong Startup Project. The bold project is the designated startup project.

Go to the Solution Explorer > Right click on the correct project and select "Set as StartUp Project" in the context menu.

I also got this error. I ultimately got to know that I was not selecting .sln file.

In VS, you should select .sln file and it automatically loads the complete project structrue is what I learnt.

Selecting .sln file worked for me

1

These errors are mostly because you are not selecting the .sln or solution file. In your solution explorer tree, double click the solution file and then build and run.

This runs contrary to a users intuition that simply opening a file and running it would work. Consider it a poor user interface. Jet Brains Rider, for instance, does not have this issue.

Change Targeting Platforms with the Configuration Manager and Build the project then try to debug it.I hope this will help you.

Don't export the project folder. upload the .sln file. It will work.

enter image description here

1

DLLs cannot be ran/debugged directly. You have to specify host application in the Configuration Properties>Debugging>Command and then let it load the DLL by itself.

You will most likely need to copy the DLL to the directory searchable by the host application e.g. its root or ./plugins folder. In the Configuration Properties>Build Events>Post-Build Event>Command Line simply enter something like:

copy "$(TargetPath)" "$(HOST_APP)\plugins" 

The Startup Item needs to be a .exe file. It's looking at BusinessLayer.dll because BusinessLayer is currently the Startup Project.

First, build the solution. Then, set the Solution Explorer to folder view and find the .exe in one of you project's /bin folders. Right click on it and set it to the Startup Item.

Finally, click the play button in Visual Studio top bar.

EDIT: Basically the same as Thomas' answer, but I'm pointing out that the "correct project" is the one with the .exe file. I would have commented on his answer, but I have less than 50 rep right now.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like