Cant start visual studio debugger (VS 2017, Unity 2017) anymore

Hey,

until now i never had any problems with visual studio and attaching it to the unity editor. But somehow im not able to start the visual studio debugger anymore.
This is the response i get:

3190994--243696--upload_2017-8-21_16-34-36.png

"A project with an Output Type of Class Library cannot be started directly.

In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project."

I am using:
Visual Studio 2017
Unity 2017.1.0p3

EDIT: To clarify a few things: I was able to debug through attaching visual studio to unity via this button until now:

3190994--243700--upload_2017-8-21_16-59-31.png

But as you can see it only says “Start” and not “Attach to unity and start”. Of course i can still start it via Debug->Attach to Process but thats a real pain in the arse to do everytime i want to debug my stuff.
Never had this problem with VS15 and never used Tools for Unity in VS.
I even tried to install it but the button remains the same.
I would appreciate any help in bringing back the attach to process shortcut…

same problem. I go back to vs2015

Install Visual Studio 2017

I’ve come up with the save problem, how did you fix that???

To be honest i dont remember fixing it. I just switched back to VS15 on my office pc because i still had it installed and set up. On my private pc im using VS2017 without any problems so far.
If you really want to use vs2017 and cant get rid of the problem even after a restart, reinstall of unity etc, you can manually attach the debugger to a process via Debug → Attach to process… (ctrl+alt+p) and then pick the unity.exe from the list.

But that is really a pain because you have o do it each time you want to debug.

You need to install the game development features for Unity for Visual Studio (mainly the Visual Studio Tools for Unity) then you will have an Attach to Unity button instead of just the plain Start

I have found the solution that worked for me. navigate to the project folder and delete all files that start with the name of “Assembly-CSharp” this reset the assembles.

Rebuilding Unity’s Asset Database by deleting the Library folder of the Unity project fixed the issue.

Following worked for me:
First: Close Visual Studio
Then: In The Unity Editor Menu go to: Assets > Open C# Project
Visual Studio opens and the project can be attached to the unity instance as usual.

3 Likes