Projects not found in Visual Studio solutions - visual-studio

I have been getting errors in my previously functioning Visual Studio solutions.
These are stored on a network drive synced with the My Documents folder.
The error is:
"The project file '\\myfiles\users\myfiles\users\rgorr\My Documents\VSProjects\FMS\FMS4\FMS4\FMS4.vbproj' has been moved, renamed or is not on your computer."
And that's indeed the wrong directory. \myfiles\users\ is duplicated in the path.
However when I open the SLN file in notepad I see that the directory is "\\myfiles\users\rgorr\My Documents\VSProjects\FMS\FMS4\FMS4\FMS4.vbproj", which is correct.
If I try to edit this in the "File path" field in the properties window of the project that failed to load, I get an error: "Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))"
If I remove the project from the solution and re-add it, it will work. However once I save the solution and reload, it gives the original error.
Does anybody know what's going on here? It's been an issue with most of my solutions ever since migrating to a new laptop and grabbing them off of TFS. It persists in every version of Visual Studio I have installed.

Related

Mark a file/folder as deleted in Visual Studio

In Visual Studio, I moved a few files and folders around.
When I try to check my project into my repository on VSTS, I'm getting an error that reads as below and fails to check my project in.
"Could not find a part of the path..."
Looks like the issue has to do with those files/folders that I moved around. Funny thing is I did all that inside Visual Studio, hoping it would understand what I was doing and not give me this error.
Basically, the folder that VS is not finding is a folder that I moved to a new location. So it should see it as deleted in its old location and new where it is now.
Is there a way to mark a file/folder as deleted? How am I supposed to fix this error.

Visual Studio - The "Copy" task failed unexpectedly

Using Visual Studio 2013, I have suddenly started getting this error when I build the solution:
The "Copy" task failed unexpectedly.
System.Runtime.InteropServices.COMException (0x800710FE): This file is currently not available for use on this computer. (Exception from HRESULT: 0x800710FE)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at Microsoft.Build.Shared.NativeMethodsShared.ThrowExceptionForErrorCode(Int32 errorCode)
at Microsoft.Build.Tasks.FileState.EnsurePopulated()
at Microsoft.Build.Tasks.FileState.get_FileExists()
at Microsoft.Build.Tasks.Copy.IsMatchingSizeAndTimeStamp(FileState sourceFile, FileState destinationFile)
at Microsoft.Build.Tasks.Copy.DoCopyIfNecessary(FileState sourceFileState, FileState destinationFileState, CopyFileWithState copyFile)
at Microsoft.Build.Tasks.Copy.Execute(CopyFileWithState copyFile)
at Microsoft.Build.Tasks.Copy.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() ScottProj
I have not changed anything regarding build tasks or project / solution configuration that should cause this. I was making code changes, and then this appeared. I rolled back the particular changes that I made before this occurred, but that did not resolve it. There are no custom build events, just a simple Build -> Build Solution. I have tried these things:
Cleaned and rebuilt the solution.
Created another build configuration.
Closed VS 2013.
Rebooted.
Deleted the obj folder.
My next action is to delete the project and get it again from source control.
Any ideas to what may have caused this or prevent it in the future?
EDIT: I was able to manually copy the files into another directory and rebuild that way, excluding the "bin" and "obj" folders.
The problem was that, in our environment, the "My Documents" folder, where I had been storing the VS project, was auto-synced to a network share. But sometimes, a syncing problem would occur and the DLLs would become locked forever. (The DLLs from this issue, which I posted a few months ago, are still locked.)
My solution was to move the solution to a folder that was not synced to a network share. These files are kept in source control, so I didn't need them to be backed up.
TFS or your source control is preventing the build from editing Resource.Designer.cs file. Check Resource.Designer.cs out for edit and you should be good.
I found this problem in visual studio 2017.
Just remove the Read-Only check mark in Properties dialog box of the Resource.Designer.cs file from Windows File Explorer.
If your solution configuration is to debug folder the just change to release folder vice a versa. or you can complete delete debug and release folder and then run project.

"The project file was unloaded" when moving VS2010 project to another server

I have moved a Visual Studio 2010 project to another server by copying and pasting the folder contents into another folder on a different server.
My understand was that VS2010 handled this well; when I have done this locally it has never been an issue.
Now I get an error like this:
When I right click and "Reload project", the list of files briefly appears before disappearing again, giving the original error.
Am I doing something wrong?
I experienced the same problem today. Here is what I did and worked for me :
Open the .sln file.
Right click on the project folder and click Reload project.
You will see the projects and folders that you originally had.
You will see .xml publish file . Double click it .. You should be good to go now.
I had this problem today and it took me a while to figure out what was going on.
Your problem is most likely that your solution was originally made with a Visual Studio configuration that contained support for certain project types (such as "Windows Service" or some other exotic project type). The Visual Studio configuration you are using to import your solution does not have that support. In other words,
there is probably nothing wrong with your solution,
there is probably nothing wrong with your project,
there is probably nothing wrong with any of the files (as you mentioned they do display briefly, giving you a second of hope)
Just run the installer on the new Visual Studio and make sure the support is enabled for all the project types you need and try again.
In my case the problem was the .vbproj file had somehow been corrupted so the normal xml code was replaced with a long string of null characters. I noticed this thanks to a file that was generated in the same folder as the project file when I tried to open the project - it was called 'UpgradeLog.htm'. This had an entry saying ' Error on line 1. Expected '<' but found 'null character'.'.. suggests there may have been a recent update to Visual Studio that I hadn't noticed?
Luckily I could use my source control system to revert back to a slightly earlier version - I guess it shows how important it is to have backups!
In my case, I saw similar message (Projected was unloaded) and all I had to do was simply re-launching Visual Studio (2017) in Admin mode and the problem went away. Per one of the above answers, I tried to right-click and selected Reload but got a warning that, due to required access to IIS on the machine, I had to launch VS in Admin mode.
HTH
Found this answer and it worked for me.
Note:Sometimes, the path in File path property is grayed out and you are unable to get to the Browse button. In this case try deleting .suo files. Don’t worry, these files gets recreated when you rebuild the solution / project.
http://www.howtosolutions.net/2013/02/solving-project-file-error-could-not-find-part-of-the-path-with-visual-studio/
I had the same problem. I fix path to .csproj files in the .sln file with a text editor and now it is all ok.
Open Visual Studio as Administrator

The working directory does not exist in Visual Studio 2010

I am using Visual Studio 2010.
I wanted to study some code that dumps relevant data in a database, find out how it works and adapt it to my own version.
I only got as far as loading the solution in VS 2010, hitting the "Start Debugging" button, and then I got this error:
The working directory does not exist:
'D:\Dev\CodeProject\articles\smartcardfmwk\Smartcard_Framework
How can I fix this error?
The source code in question is Smart Card Framework, from Code Project
I downloaded the "Updated Project (VS2010)" and I can open it in VS2010, as well as build, but debugging just wouldn't work.
I did not try replicating the path yet, but as this is a working project, my company requires that it is placed on a very specific location accessible by others.
Nevermind, I got it. It was so simple, I'm sorry for wasting anyone's time.
The source Solution had a lot of Projects under them. I figured at least one of them was pointing to a directory that doesn't exist, so I waded through the Projects,
I right-clicked a Project and clicked the Properties
This will open up the ProjectName Property Tab
Under the Debug tab, there is a filed called "Working Directory"; I changed it to where the project is currently located.
This solved my problem, for now, unless there's a Project I missed. I am wondering, though, if I have to do this again if I move the Solution elsewhere.
This happened also in VS 2019 after importing / upgrading an old C# project. I was not able to see any project properties to change.
Finally it was fixed by manually editing the file <ProjName>.user.csproj as follows:
Replace
<StartWorkingDirectory>[wrong directory name]</StartWorkingDirectory>
with
<StartWorkingDirectory>.\</StartWorkingDirectory>
I also faced this problem that working directory does not exist, but I managed to solve it. There are certain steps to follow properly Whenever this error occurs.
In VS, open the "Project" at Toolbar.
Then go for Project properties.
Select Debug And check your working directory. If the path is wrong just browse it...

Visual Studio Cannot Open File

I'm working on my first project in Visual Studio and I haven't used Windows much since '05, so please bear with me.
I've got my project open in Visual Studio 2008, and I'm trying to open a particular file for editing, but I get an error that says
"c:\path\to\file
Cannot open file.
I've verified that the file exists, and I can open it from Windows Explorer, but nothing from inside Visual Studio, any ideas?
I'm not familiar with Visual Studio, so my terminology might be incorrect.
The file appears in the tree in the Visual Studio Explorer pane, so I double clicked it, and got the error. The error said nothing more than the file path: Cannot open file.
How can I check permissions/ACLs in Windows? I assumed that since I could open it in Windows Explorer, I would be able to open it in Visual Studio.
And it's a .cpp file.
You may want to right-click on the file in the tree, and delete it from the project.
Then, add back an existing item.
Hopefully that will fix the problem.
Though I'm not familiar with this specifically, if you just want to move forward, I'd recommend creating a new project type and just adding all the existing files to it. Should be quicker and easier than diagnosing what could be many issues.
Other things to check: encoding type of the project file, permissions/ACLs (can you open that actual file from an unelevated VS prompt, for instance), etc.
Additionnaly to the other answers, I found out that this problem may arrise if the target .Net framework version specified in the project file isn't installed.
This seems to prevent visual studio from opening all the files contained in the project, and showing the "Unable to open file " message.
Correcting the version (in the csproj file or in the settings), saving and reloading the project fixes the problem.
I had same problem, my project were build on (.Net 4.5), which I uninstalled on my PC and replaced by (.Net 4.8), so just replacing project's target framework to the one which is installed "in my case (.Net 4.8)" should fix it.

Resources