Renaming the folder which contains my .csproj file - visual-studio

so I’ve been trying to rename a old project that I had been working on but every time I rename the folder that contains my csproj it won’t load and asks to load the the file with the folder name
My old project was Metroloader/Metroloader.csproj
The thing I want to change it to is Nutsloader/Nutsloader.csproj

Close Solution
Rename folder
Open solution
Remove not loaded project from solution
Add existing project from new location:

You need to edit .sln file and provide correct folder path to your renamed .csproj

Related

Visual studio wrong file path for Form1.cs file

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

Move packages folder inside the solution folder

Visual Studio 2017 / ASP.NET Web Application solution.
The default folder structure is as follow:
What I want to achieve is keeping everything (including packages) inside the WebApplication1 folder (except WebApplication1.sln file).
I know about NuGet.Config but unfortunately it seems mandatory to place this file next to the .sln file. I would have preferred to place this file inside of WebApplication1 folder. I would like to have ONLY ONE file outside of the solution folder: the WebApplication1.sln file.
I know about NuGet.Config but unfortunately it seems mandatory to place this file next to the .sln file. I would have preferred to place this file inside of WebApplication1 folder. I would like to have ONLY ONE file outside of the solution folder: the WebApplication1.sln file.
I understand your requirement, you want to have only WebApplication1.sln file outside of the solution folder. But if you are using nuget.config to change the location of packages, this nuget.config file will be placed in a folder outside the solution folder, which is not what you want.
To resolve this issue, you can put this nuget.config file outside the solution folder, which is not necessary to put this file next to the .sln file, for example, you can put this file in the root directory of the C drive with following content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="C:\Users\<UserName>\source\repos\WebApplication1\WebApplication1\packages" />
</config>
</configuration>
Then close your Visual Studio and delete the packages folder in the solution folder, re-open the Visual Studio and open the your solution, right click on the your solution, select restore the nuget packages, all the nuget packages will be place inside the solution folder and the only file outside of the solution folder is the WebApplication1.sln file:
Note: This method has its own limitations, we have to use absolute path in the nuget.config file and this setting will still be work for other solutions.
Besides, you can try to use PackageReference instead of packages.config in project files. With PackageReference, your packages are point to the global package folder C:\Users\<UserName>\.nuget\packages, so that we do not need add a nuget.config file to change the package folder.
To use the PackageReference, go to the Tools->NuGet PackageManager->Package Manage Settings:
Hope this helps.
My understanding of why the visual studio put the package folder next to .sln but outside WebApplication1 folder is, WebApplication1 is a project in the WebApplication1 solution. But one solution can contains multiple projects. In your case the project name happens to be same as the solution name(due to when you create this project and solution in vs). So if you have multiple projects in this solution but want to share some nuget packages, then it make sense for the package folder to be outside the project folder.
Thant's my understanding for why vs has this default setting. Hope that helps.

How can I rename a .app file?

I have created a project by duplicating an existing project and renaming the project and schema. Can I rename the .app file from within Xcode?
I already have try this RENAMING TUTORIAL from Apple but it didn't rename my folders and my .app file.
I finally found the solution:
Build Settings -> Packaging -> Release Name
Double click your Project name and rename your project. Note that it will rename your application name and product name not folder name on physical drive.

The file is not under version control

I'm using a Git. When I add a file and check "Copy items into destination group's folder (if needed)" this error occurs:
Try adding it to your project folder and then drag-and-drop to the project in Xcode.
If it still doesn't work you can just create a new file in the project itself, call it the same as the file you are trying to copy and then copy-paste all the code.
Hope it helps
Just delete the file reference from the XCode. Make sure not move file to trash. Then add the file again by drag and drop or by Add file to project option. Now the file will be under source control.

Xcode - Dealing with folders by code

When you add a folder that contain subfolders and files to the Xcode project, the Xcode ask you about the folder option:
Create groups for any added folders.
Create folder references for any added folders.
I want to download the folder from a server. When the download is complete, the folder option will be 1 or 2? How can I set the folder option to option 2?
When Xcode references a folder, it uses whatever files are stored at that location on your local disk. If you download a new file to that folder or copy a file into that folder, it will show up in your Xcode project. If you change a file in that folder (by overwriting it in the Finder, or by using another app to download another copy of the file over the existing one), Xcode will use the new one.

Resources