Visual studio wrong file path for Form1.cs file - visual-studio

I am trying to open a project which was created on one computer but has since been moved to another one due to the computer going caput. Now when I open the project and try opening the Form1.cs file, or any of the designer files, I get the error message saying "Cannot find the file 'C:...\Form1.cs'. It may have been moved or deleted". I have omitted the full path which is a reference to the old computer.
How do I change the file path so that my project can find it?
I have found another thread on this issue: Visual Studio retrieving an incorrect path to a project from somewhere
Have tried all of the suggestions (deleting .suo files, moving the project to a new folder, etc.) Nothing has worked so far. There is however in the accepted solution a reference to "Manage Workspaces" and "Source Control Explorer", which I literally can't even find in my Visual Studio window.
Help please!
Alexander

First: Open your sln file and see where it says your csproj file is located. It should read something like: "WindowsFormsApp1\WindowsFormsApp1.csproj"
Note: Everything in the parenthesis will be from the same directory as the sln file, so the true directory in this instance will be "sln_file_path\WindowsFormsApp1\WindowsFormsApp1.csproj"
As long as this is correct, then navigate to the csproj file and open it with notepad, but if this path is wrong, correct it before proceeding.
Second: Search the csproj file for the missing file, which in your case is Form1.cs
You should find something like: Compile Include="....\Erroneous_Directory\Form1.cs"
Typically all cs files will be in the same directory as the csproj file, so the line should simply read as follows: Compile Include="Form1.cs"
If the file is legitimately located in a separate directory, then provide the path, but if it is in the same directory, delete the path. Sometimes, when linking to a file in a different project, you will see this: (Link)Form1.cs(/Link), but if the file is in the same project and directory, this link line will need to be deleted.
Note: Chances are that this procedure will need to be repeated for two other files: Form1.Designer.cs and Form1.resx as well, so make sure the "Compile Include" lines for these two files are also correct before opening the solution

Related

A matching symbol file was not found (Cannot find/open pdb file)

The debug point is not getting enabled when this module gets loaded. So I thought of manually loading its debug symbols .pdb file from "Debug/obj" folder.
In this case I am getting below error "A matching symbol" file was not found in this folder though that folder contains currently build file.
And also the "Symbol Load Information" contains these many directory paths.
Cannot find or open the PDB file.
PDB does not match
Screenshot:
This problem is fixed by the following steps-
1) Close all the instances of VISUAL STUDIO if running and open a single instance of Visual Studio
2) Close the solution (nothing but your project) If it's already open and then re-open again
3) Clean the whole project and rebuild it.
4) and also build the project if you are getting any errors like "___.dll not found"
5) Now you are good to go and run your project
After breaking my head on this, for me it happened when I configured my project to seperate binaries from objects that way:
For Output directory:
$(SolutionDir)build\bin\$(PlatformTarget)-$(Configuration)\
For Intermediate Directory:
$(SolutionDir)build\obj\$(PlatformTarget)-$(Configuration)\$(ProjectName)\
Even though the I still had the generated .pdb where my exe or trying to even load it manually, it didn't work.
So I went again to Configuration Properties -> Linker -> Debugging and where the property Generate Program Database File I changed from $(OutDir)$(TargetName).pdb to $(IntDir)$(TargetName).pdb so it will throw the desired database file into the place where the objects(Intermediate Directory) are instead of where the .exe(Output directory). Hopefully that helped someone :)

Xcode 7.3 - Throwing "directory not found for option" Even if The Directory Did Exists

I am getting this warning a couple of times stating that the library directory is not found. I've tripled check the directory, and IT IS THERE. I tried to clean the project but still didn't work.
The strange thing is, when I remove the library(The whole folder) and copy-paste a new one, it will work - What I mean here is I deleted the source file from the main directory of the project and copy-paste a new one from another directory, then I will add the files to the project.
But after building a project for a couple of times without editing the directory or the contents of the library, this error will happen again.
It's like, when I fix this problem, it will be OK for now, but when I rebuild the project next time without editing anytime, the error will occur again.
I am not sure if this case has something to do with path containing spaces.
Instead of copying and pasting the directory you should: File > Add Files ... to your project. Xcode is likely losing the reference to it because the files are not "added" to the project.
I solved this problem by removing the space within the directory name. My directory name before was Name Name, Then I changed to NameName. Now the problem is gone. It's really strange, I don't think spacing would produce such problem.

Renamed visual studio project, error when publishing (ResolveAssemblyReference.cache)

My solution contains two projects. Both have been renamed from 'LearnUmbraco.*' to 'OnceUpon.'
The solution builds fine, however when trying to publish via FTP, the error occurs:
Error Copying file obj\Debug\LearnUmbraco.csprojResolveAssemblyReference.cache to obj\Release\Package\PackageTmp\obj\Debug\LearnUmbraco.csprojResolveAssemblyReference.cache failed. Could not find file 'obj\Debug\LearnUmbraco.csprojResolveAssemblyReference.cache'. 0 0 OnceUpon.WebUI
If I look in my obj/Debug folder i do indeed have a ResolveAssemblyReference.cache however it is obviously prefixed with ;OnceUpon.**.'.
Where/how is this file generated. I'd like to change the configuration so it looks for the renamed version.
Many thanks
Found the issue. Close the solution and open the csproj file. The old references were still in there.

VS2010 "Copy to output directory" not working?

I'm trying to publish my web solution to the file system, using the "Only files needed to run this appllication" option.
I have the following problems:
a) I have a connectionStrings.config file that should be included; I've marked this file as Content and Copy Always.
b) For testing purposes, I've added a textfile.txt that should not be included; I've marked this as Content and Do Not Copy.
Both of these settings fail...
It seems that the setting "Copy to output directory" is simply disregarded.
Any ideas why this happens, and what to do about it?
The "Copy to output directory" is for when you are building your application, not publishing it.
This property specifies the conditions under which the selected source file will be copied to the output directory. Select Do not copy if the file is never to be copied to the output directory. Select Copy always if the file is always to be copied to the output directory. Select Copy if newer if the file is to be copied only when it is newer than an existing file of the same name in the output directory.
Source
There's more information on publishing web sites and applications here
I had the same problem, that files marked as content, with "copy always" set, were not appearing in the output dir.
At the time i noticed this, i was tracking down why certain of my dlls were not getting deployed.
Sorting my project dependencies fixed both issues.
I just had this problem and for some reason choosing "Create application without a manifest" under the project's properties finally copied the linked content file to the build directory.
I re-started my visual studio and select the "copy always" option again. Rebuild and worked.
Good Luck.

How can I remove files from a QtCreator project

Might be a very newbie question, but I can't find a way to remove files from my projects in QtCreator. Thanks!
If your project is generated from CMake, the file list is determined by the CMakeLists.txt file, and you cannot add or remove files manually from the source tree in QtCreator. Especially if your CMakeLists file specifies the glob operator for a project's file list, you must manually remove the files from disk and re-run CMake from within QtCreator by going to Build->Run CMake (QtCreator 3.3.0). This will update the file list but also regenerate the project (cbp) file - re-running CMake outside of QtCreator will not update the project file and you will have ghost entries of deleted files showing up in the source tree if you deleted them from disk.
Right-click the file you want to remove, and choose "Remove File..."
Checking the "Delete file permanently" check box will delete the file, otherwise it will just be removed from the project.
Find your project file .pro in qt creator or other text editor
Find the file/folder name you want to remove in the .pro file
Delete all the files you want to remove
save and close the project
Reload the project
DONE
Could not find one-touch action as in Eclipse to delete a class:
1) Press right click on the file/class, and then choose "remove file..."; (u can tick "permanently" to remove from HDD if you like).
2) Do it to .CPP and .H files.
3) Then check in your .pro file the class are not there anymore.
Note: Some compilers will keep searching for this file/class in compilation. Just delete the compilation directory and compile again.
If you mess up like me and accidentally add a lot of files to the qml.qrc, it might help to know that these are listed in the actual qml.qrc file which you can edit to remove these files.
I also run into this problem.
I wanted to remove a header file.
But remove action in context menu was disabled I didn't know why.
The file name was qtextdocument.h.
I wanted to change the name to textdocument.h.
I tried to do various ways, but the filename was strictly fixed.
My removal procedure was as follows:
I dare to add an empty file to the file directory (in header file directory).
Anyway, I set the file name as textdocument.h when Qt Creator asked me to set the filename.
A confirmation warning popped up.
(Qt Creator cannot add the file automatically, we must add the file name to CMakeTextLists.txt)
I changed the filename in CMakeTextLists.txt from 'qtextdocument.h' to 'textdocument.h' in the row of set(PROJECT_SOURCES).
Finally, the update was confirmed. 'qtextdocument.h' was removed and the name is changed to 'textdocument.h'.
If you only want to remove a file, only you have to do is to delete the filename when you are in step 3.
After updating the project tree, the actual file is in your computer.
If you want to delete the file completely, you select file system and remove the file, not from project.
I don't know why, but in the case of filesystem mode, remove action is enabled.
So I might & should have told you that you select "filesystem mode" and remove the file at the first time...
(Sorry I have found out this fact later.)
Both of the two ways, I think we must rewrite the contents of CMakeTextLists.txt.
I also run into the case , the update removed the filename as soon as I deleted the filename from CMakeTextLists.txt.
I believe this case I directly make a file in the actual directory. On the contrary, above case is the files are added from Project menus.
go directly delete the project folder from your hdd.
For Linux, edit ~/.config/QtProject/QtCreator.ini
Under [ProjectExplorer], delete the project name and its corresponding configuration file from the following two lists:
RecentProjects\DisplayNames
RecentProjects\FileNames
e.g., given the following
RecentProjects\DisplayNames=proj1, proj2, proj3
RecentProjects\FileNames=<proj1_dir>/CMakeLists.txt, <proj2_dir>/proj2.pro, <proj3_dir>/proj3.pro
to delete proj1 from the qtcreator startup page, edit the above two lists as
RecentProjects\DisplayNames=proj2, proj3
RecentProjects\FileNames=<proj2_dir>/proj2.pro, <proj3_dir>/proj3.pro

Resources