Create a physical copy of the source file in Visual Studio

In Visual Studio, if I try to copy a file from one project to another (using Copy and Paste or dragging the file to a new project, holding down the Ctrl key), it creates a link to the original file in the original location. Is there a way to create a physical copy of the source file and put it in the original direction of the target project without resorting to using Windows Explorer to manually copy the file?

+4
source share
2 answers

This is not very, but when I want to do what you offer, I double-click on the file in Visual Studio that opens it. Then I do File->Save As , select the correct directory and save it. All from Visual Studio. This is usually followed by adding a new file to another project.

I just did it and realized that I should mention a side effect. Depending on your source control (in my case, TFS 2010), doing this from Visual Studio may change the location of the file in the project. For me, this means that to ensure that neither the file nor its project has any pending changes, save as, and then undo the change that it causes in TFS 2010 (change the project, add and delete the file) .

+1
source

From http://msdn.microsoft.com/en-us/library/0fb6xxhb.aspx :

If you work with solution elements, Visual C ++ projects, or other similar projects, you always work with links in Solution Explorer. If you work with Visual Basic projects, Visual C # projects, and other projects, you can work with links or files.

In fact, the answer to my question is "No." In most cases, I should use Windows Explorer.

+1
source

Source: https://habr.com/ru/post/1414855/


All Articles