Visual Studio 2019 "attach" instead of "start" issue - c#

Basically, after installing visual studio on my second computer I went to make a simple console application. Instead of saying start or letting me run the program it would just say attach. It works perfectly fine on my other computer and I downloaded vs the exact same way on both.
I also tried doing "dotnet --version" in the command prompt on both computers and the computer that works is able to find a .NET version on my computer but the one with the issue cant, it says I haven't downloaded it... when I go to download .NET separately it still doesn't work.
In my solution explorer it says "0 projects" even though I clearly have a project file in the folder along with the solution. When I try to add an existing project it simply doesn't let and says "The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version".
I also tried the solution from this thread: Microsoft Visual Studio 2019: The project file cannot be opened. Unable to locate the .NET SDK
and it didn't change anything.
I've tried reinstalling and repairing visual studio and even that didn't help at all.
If any of you have any idea what I could do to fix this that'd be great!

That usually happens when you open the project from the project file, from the folder that contains it, instead of opening it from VS. Try open VS first, and then browse to open your project and should work. Another way to solve it is clicking on "reload" once the project is open.
Some other times it happens when you open the (.cs) file instead of the project file. Attach - start issue

Related

Unity Intellisense doesn't work(Solution1, Miscellaneous Files issue)

I can't use Intellisense in visual studio. When I double-click a c# file in Unity, visual studio shows up. But on top, I can't see my project name. Instead there is "Miscellaneous Files". So Intellisense doesn't work.
What I've already tried:
1
I opened the external script editor, it was default "open by file extension". I changed it to vs 2017 and vs 2019. But this time when I open my scripts from Unity, it doesn't open. So I changed it back to "open by file extension".
2
I controlled the visual studio tool for Unity. I already downloaded it.
3
In solution explorer, right clicked and added "RegularFight.sln" again. Nothing changed but then clicked folder view. And I can use Intellisense. But this is temporary. I have to do this everytime.
4
Show the project on explorer. There is "RegularFight.sln" which is my projects name and which is 1KB. So it means it's an empty solution. And there is "Assembly-CSharp.csproj" it's 45KB and it includes my scripts. When I open it I can use Intellisense.
So I want to use Intellisense when I open my script from Unity. How can I fix it?
Unity version: 2020.1.7f1
Seeing "Miscellaneous Files" means that your Visual Studio is not properly synced with Unity. You're seeing just a plain old C# file by itself, not a file that is associated with a Project.
The steps to rectify are usually:
Make sure "Visual Studio Editor" ( a.k.a. Visual Studio Tools for Unity) is installed in Package Manager.
Go to Edit > Preferences > External Tools and make sure that Visual Studio is set as your "External Script Editor".
Restart both Unity and Visual Studio, or even your whole machine to make sure.
Here's what you should be seeing (or something similar depending on your Unity version).
And your preferences should look similar to this:
After making sure all these items are in place, 9 times out of 10, that will resolve your issue.
You also don't want to be adding or touching .SLN (solution files) directly. Unity will add all of the projects and references required to the solution file. Any changes you make will generally be overwritten by Unity.
After doing all the normal steps, try reloading the project in Visual Studio, within the Solution Explorer. (if you're able to open VS, of course)
Try following the steps here and see if it resolves your issue. It could be .NET API compatibility level issues if your Unity Library extension seems to be installed and working fine.
https://blog.terresquall.com/2020/11/getting-visual-studios-intellisense-code-autocomplete-to-work-for-unity/

Unable to copy file .exe in Visual Studio 2017

I have an asp.net core project that references .NET Framework and I'm using Visual Studio 2017 Enterprise. When I try to build my solution, I came across with this error:
Unable to copy file "obj\Debug\net461\MyProject.exe" to "bin\Debug\net461\MyProject.exe".
Access to the path 'bin\Debug\net461\MyProject.exe' is denied.
Even if I cleaned the solution and build again, I still have this error.
Anyone faced this error?
Go to Task Manager and look for Microsoftvshost.exe and kill them all. Even though you stop debugging the exe can continue to run in the background. This causes a lock on the file.
Close the application and delete Obj and bin folder
First, make sure you have the .net core localhost server stopped, before trying to build the solution.
I have seen this error before. Trying the following has worked for me:
1. Close the current solution.
2. Close Visual Studio.
3. Start Visual Studio in Administrator mode.
4. Re-open and build the solution.
The above can avoid the common copy file and file Access Denied errors.

VS 2015 w/ Xamarin: This item does not support previewing

I'm using Visual Studio 2015 with Xamarin 4.1.2.18 and CocosSharp PCL 1.6.2.
When I try to access the Properties of the Android project by clicking on the "Properties" item in the Solution Explorer, this error pops up:
If I also right click on the project itself and select "Properties", it displays "This item does not support previewing".
It should be opening up to this page:
I have (supposedly) the latest build and Update 3. I have reinstalled it 3 times now.
Normal uninstaller. Reinstalled... nothing, still broken.
Uninstall again with cmd: /uninstall /force, use registry cleaners, manually uninstall components from Control Panel, manually delete folders. Reinstall... still broken.
Finally, I searched around and found this: Microsoft Visual Studio Uninstaller. After I, again, performed all the steps of 2, I used this tool and it found 52 additional things to clean up. I thought I finally had fixed it. Nope. The properties thing is still broken.
I have tried running as administrator. Nope.
I have deleted the ComponentModelCache in local AppData. Nope.
I have deleted the .suo file. Nope.
I know it has nothing to do with the project files because we have all the files synced with Git and my friend can view the properties page fine on his computer.
Does anybody know how I can fix this?
Is there some way to gather more information on the error?
Any Visual Studio error logs?
Also, on an semi-unrelated note:
When I try to build the Android project, I get errors saying that the $(TargetFrameworkVersion) for my references/dependencies is v4.2 and the $(TargetFrameworkVersion) of my project is v2.3. I checked my TargetFrameworkVersion property in the .csproj file and it's v6.0!
So, something is seriously wrong with this build of Visual Studio or something.
I've been considering just installing Visual Studio on a VM just to be sure.
Solution:
In the Android SDK manager, I had Android 4.0 (API 14) downloaded. Once I switched to Android 4.2.2 (API 17) everything started working.
I just gotta say, the error that it gave me is the most convoluted error message that I've ever received in the history of my programming career.

Visual studio doesn't support specific csproj file

I am getting this error when I try to open the solution file of my project. The solution is 2012 file (checked using notepad).
If I click on Ok, The solution opens up except for one csproject which does not load.
I get a migration report in UpgradeLog.htm file, with the following error for the project which failed to load. Could not figure out much from it.
Error:
The application which this project type is based on was not found.
Please try this link for further information:
http://go.microsoft.com/fwlink/?prd=12395&pver=11&sbp=ProjectTypeDeprecated&plcid=0x409&clcid=0x409&ar=MSDN&sar=ProjectCompatibility&o1=82b43b9b-a64c-4715-b499-d71e9ca2bd60
Does the upgrade report mean that it is a project from previous version of Visual studio? It does not open in Visual Studio 2010 either.
The error doesn't say that Visual Studio doesn't support .csproj files at all, it says it doesn't support a specific project type in that particular project file. This means this either isn't your project as you claim, or you are trying to build it on a different machine from the one used to create the project.
Visual Studio uses various elements in a .csproj file to determine its project type. See How do you tell the Visual Studio project type from an existing Visual Studio project and What is the significance of ProjectTypeGuids tag in the visual studio project file. It does this so it knows how to compile your project, what properties tabs to show, what context menu options should be available and so on.
Certain project types can cause this error. Usually they require some kind of SDK to be installed on the machine used to open or build the project.
You should search the web for the GUID mentioned in the error message you show (the value after o1=). You can also open the project file in a text editor and find the <ProjectTypeGuids> elements, which contains comma-separated project type GUIDs.
Then search the web for those GUIDs to find out which SDK or tool you need to install in order to be able to open or build the project.
If you paste the specific GUID from your error message in your favorite web search engine, you'll find Problem solved: Visual Studio / There is a missing project subtype. Subtype: '{82b43b9b-a64c-4715-b499-d71e9ca2bd60}' is unsupported by this installation., where it is mentioned you'll need to install the Visual Studio 2013 SDK. This means that in this case, your project is a Visual Studio 2013 extension.
This is what documentation is for. You should at least put a ReadMe.txt file in your project directory, explaining what the prerequisites for building a project are, especially when it won't open or build with Visual Studio out of the box.
I had this issue when I used Update 5 for VS 2013.
For me I had to click ok and read the next few steps, that popped up. I was initially clicking cancel.
On mine the project was missing Web Tools, so had to reinstall those and once done it was working.
Hope that helps someone.
This issue also appears when trying to import an ASP.Net project into Visual Studio 2015 Express for Desktop, and can be solved by simply downloading and installing Express 2015 for Web - or by using Visual Studio Community/Standard.
I am currently using VS 2017 v 15.7.4. This error came out of no where without any updates on my part. Usually when I have errors like this I just delete the .vs folder in my solution and that clears the problem. In this case that is what I did and the problem was fixed.
Close VS
Delete .vs folder
Load VS
Note: This was for a Xamarin based solution.
I solved this problem by downloading and installing (Microsoft Visual Studio Installer Projects). Close the project then install. After the installation, open your project then reload .csproj file
I had the same issue with VS 2017.
Eventually i solved it by just enable the SSIS in the following way:
1. In VS 2017 - Click on Extensions and Updates in the Tools menu.
Locate the Microsoft Integration Services Projects.
if you can't find it then you will have to install it first.
Click on the Enable button.
Close VS and start it again and SSIS projects are now available.
enter image description here
This (the error that states "Visual studio doesn't support specific csproj file") also occurs when the .vs folder is removed; however, closing and reopening Visual Studio will resolve the error.

Visual Studio 2012 csc.exe Error. Executable not valid for OS

I am getting the following error when trying to compile and test any type of project in Visual Studio 2012 Professional.
Error 1 The specified task executable "Csc.exe" could not be run. The
specified executable is not a valid application for this OS platform.
After testing multiple suggestions online nothing has fixed the problem. Anyone know what is causing this? Is there a new version of Csc.exe I need to get a hold of? I know this is the compiler just not sure what I need to do to fix the problem.
I had this exact problem today on my Win7 Machine. As Hans suggests, 'Navigate to C:\Windows\Microsoft.NET\Framework\v4.0.30319 and type "csc".'
The file may still exist but if you can open it with notepad, it will probably show just plain text of some errors. This is the indication that your compiler has been destroyed. At my office we have come up with a theory that a Windows update may be causing this because only a few machines have been affected, but I haven't read much online about it until now.
We fixed this by copying someone else's csc.exe into the C:\Windows\Microsoft.NET\Framework\v4.0.30319 directory and recompiling. Be sure to set the options on the file to read-only so this won't happen again. Good Luck!
The problems associated with csc.exe in Visual Studio 2012 can mostly be solved by repairing Visual Studio.
You need to repair Visual Studio. Go to Control Panel -> Programs. Then select your version of Visual Studio you are using and press "Change"(or right click it and press "Change"). When the setup appears, click "Repair".
I am on Visual Studio 2017 but this is the first google result that pops up for "csc.exe not found"
When I got this error I had to restart Visual Studio, being sure to select 'Run As Administrator'. Everything worked after that
I've faced this problem while i am trying to move Asp.Net Mvc Project from one computer to another ; error message was : The specified task executable location "c:\users\mypcname\documents\visual studio 2015\Projects\TestMVC\packages\Microsoft.Net.Compilers.1.0.0\build\..\tools\csc.exe" is invalid.
I solved this by
Creating new Mvc Project ;
going to that folder \Microsoft.Net.Compilers.1.0.0\build..\tools
and Copied the csc.exe file to my Projets >> \Microsoft.Net.Compilers.1.0.0\build..\tools\
i think when i was copying the project from the original Computer i left that csc.exe file in the specified folder.
Hope this will help someone.
Check your solution properties (right-click on Solution and select 'Properties') and make sure that the 'platform' field (Configuration Properties) is set correctly.
I think this problem is caused due to improper PC clean up. I was running Quick Heal PCTuner 3.0 software on a 64-bit windows 7 machine but suddenly due to loss of power my machine was shut down then when i opened it again I was getting this problem in VS 2013. Even TortoiseSVN checkout was not working and throwing internal error and something like corrupted disk also was shown when trying to delete some files on the harddisk.
I ran the PC Tuner again doing the Disk, Registry and traces clean up and it got fixed. maybe this problem may occur due to other cases also but is mostly related to the system's files In my case this is the fix
Regards.
in my case helped (I had .net framework 4.5.1 and vs c# 2010 express):
download the newest .net framework and run repair
On Visual Studio 2013, the same problem solved by doing this for me:
Right click the solution and open Configuration Manager. For the project(you may see at least one there), I've changed the Platform from Any CPU to x86 for the project that may causing the problem.
I've tried to delete and move csc.exe file but it doesn't do anything.
Then simply I upgrade .net version and than downgrade (returned to its original state) and it works.
I solved my problem by copying the whole folder containing my visual studio solution
From C:\Users\me\Google Drive...
To: C:\Users\me\OneDrive...

Categories