Reputation: 5199
Is there a plugin/trick/macro for visual studio which automatically moves all files present outside a project directory and added as link, to the project directory and alters the location of the file in the project itself?
|--Project1
|--File1.vb REM: already inside the project folder
|--File2.vb REM: outside the project folder and added as link to project1.
Is there any way to accomplish this?
|--Project1
|--File1.vb REM: remains as it is
|--File2.vb REM: now moved to project1 directory.
Upvotes: 4
Views: 715
Reputation: 20044
It should not be too hard to write such a tool by yourself. The project files are just XML files, and references to source files look like this:
With links:
<ItemGroup>
<Compile Include="..\Path_To_External_File\SourceFile.vb">
<Link>SourceFile.vb</Link>
</Compile>
</ItemGroup>
Same without links:
<ItemGroup>
<Compile Include="SourceFile.vb" />
</ItemGroup>
So write a very simple program or script which reads all the project files to be processed, loop over all <Compile>
items, make a copy of the source file or just move it to the desired location, and adapt the XML of the project file accordingly. If you have ever programmed some XML processing beforehand, using, for example, theXMLDocument
class, then this should be implemented in a few hours (at maximum).
One final remark: you may (or may not) have to to deal with the case where the same files is referenced from different projects.
Upvotes: 3
Reputation: 626
Visual does the copy during compiling already if it's what you're looking for. On the other hand, if you want to really add the files, but not as a link, I pretty sure there is no native trick in VS for this.
Upvotes: 3