Ben
Ben

Reputation: 8905

Update Visual Studio project for moved file

The project I'm working on normally runs on an embedded Linux system, but we have a rehosted version for debugging in Windows. Naturally the Visual Studio project isn't always kept up-to-date with the files in our "real" project.

Sometimes a file is moved from one directory to another. This leaves Visual Studio unable to locate the file.

I know I can close Visual Studio, open the project file in a text editor, and manually change the file location. But this is annoying. How can I point Visual Studio to the new file location without manually editing the project file in a text editor?

Upvotes: 2

Views: 1504

Answers (1)

Dai
Dai

Reputation: 155055

First off, you don't need to close Visual Studio. You can unload a project (Solution Explorer > right click on project > Unload project), then right-click again and choose "Edit", this opens the project file in VS's text editor. After you save the file you can tell VS to reload the project by right-clicking the project node again.

However in your case, a better solution might be to use wildcard expressions in your project file, as documented here: http://msdn.microsoft.com/en-us/library/ms171454.aspx and http://msdn.microsoft.com/en-us/library/ms171453.aspx

i.e. Use a double-asterisk to tell VS to recursively search a directory to include files matching another wildcard pattern.

e.g.

<ItemsGroup>
    <Compile Include="**/*.cpp" Exclude="SomeSpecificFileToExclude.cpp" />
</ItemsGroup>

Upvotes: 2

Related Questions