Reputation: 1001
I am fairly new to C#..
I am using Visual Studio 12, the source I am using was last edited in VS 12.. But my problem is that it's throwing me this error:
First of all, my computer username isn't Martin, it is Administratoring - The creator of this project is Martin.. So that's where I guess it's coming from, but I don't know how to fix this.
I have tried editing in Project > Properties > Build > Output Path - And it still doesn't work. I am not too familiar with C#, and I've spent some time searching up for a solution but can't find it anywhere.. Probably because I don't know what I should be searching up (I've tried searching keywords and quotes from the error, but still nothing)
Upvotes: 41
Views: 182865
Reputation: 6617
I had two different build configurations (Debug and DebugCmd) with two different assembly names (let's say, App and AppCmd). If I start my VS 2019 with active Debug configuration and then switch to DebugCmd, VS still tries to debug App (not AppCmd) and fails to start it. The solution is just to restart VS after configuration switch.
Upvotes: 0
Reputation: 329
I faced the same problem , but in my solution i had many projects so in the solution configuration the start up project was by mistake a class library i changed the startup project and then i worked like a charm
right click on the sln => common proprties => choose right startup project .
Upvotes: 0
Reputation: 492
What solved it for me was deleting the line
<ImplicitUsings>enable</ImplicitUsings>
from the project property file. It caused Visual Studio to generate a (useless) file with multiple global using directive.
Upvotes: 0
Reputation:
I had the same problem with visual studio 2015 , and I found that there is reference is marked so I just deleted it , maybe you can delete this reference or reinstall it again
Upvotes: 0
Reputation: 688
You are not set the startup project so only this error occur. Mostly this problem occur when your working with more project in the single solution.
First right click on your project and "Set as Start Up Project" and/or right click on the start up file inside the selected project and click "Set StartUp File".
Upvotes: 2
Reputation: 173
So... it’s mid 2021 and I’m using visual Studio 2019 (version 16.10.2) which is the current version available, on a windows 10 pc.
I had to start a new project and following this steps solved the issue;
Upvotes: 0
Reputation: 71
Go to Project > properties > Debug Tab and set the Launch to "Project"
Upvotes: 1
Reputation: 570
Switch Target framework to 4.5.2 or something higher and bring it back to your original version (example: 4.5) then when you build, it will work.
Upvotes: 2
Reputation: 1578
Try these:
Make sure that output path of project is correct (Project > Properties > Build > Output path)
Go in menu to Build > Configuration Manager, and check if your main/entry project has checked Build. If not, check it.
Upvotes: 83
Reputation: 767
For those with this kind of problem - another solution: Pay attention also to Warnings when you build solution. For example, I had referenced a dll built with higher version of .NET (4.5.2) than my main project (4.5) After I referenced a dll built with 4.0 build process was successful.
Upvotes: 8
Reputation: 5265
In my case I had added a project to a solution manually, where that project was targeting a higher .NET version than the rest of the projects that were referencing it. Strange... there would normally be a somewhat more verbose, literal and descriptive error in such cases.
There wasn't a real error but there was a warning that said as much.
Upvotes: 1
Reputation: 383
I had the same problem and unfortunately non of above answers worked for me . the solution that worked for me is :
right click on your startup project and select Properties - Debug and change "start external program: " to the correct path
Done!
Upvotes: 2
Reputation: 191
I had the same problems. I had to change file rights. Unmark "read only" in their properties.
Upvotes: 0
Reputation: 947
I also get this error quite often.
I solve this by modifying the code (doing a very small change), saving it, then building the solution again.
Upvotes: 1
Reputation: 31
Please try with the steps below:
P.S. I experienced the same problem when I was playing with the options to redirect the console input / output to text file and have selected the option Properties - Debug - (Start Action section) - Start external program. When I moved the Solution to another location on my computer the problem occurred because it was searching for an absolute path to the executable file. Restoring the Visual Studio Project default settings (see above) fixed the problem. For your reference I am using Visual Studio 2013 Professional.
Upvotes: 3