way to find dead files?

  • Thread starter Thread starter not_a_commie
  • Start date Start date
N

not_a_commie

Is anyone aware of an easy method to search a solution for dead source
files? I'm not talking about files that show up as little white boxes
when you check the "Show All Files" button on the toolbar. Rather, I
want to delete all source files that aren't referenced by any project.
 
I don't think there is a way that is built into the system, but you
could parse the .csproj file (it is XML) and get the list of files that are
used by the project. Then, you can compare it to what is in the directory,
and clean away.
 
<Project >
<ItemGroup>
<Compile Include="Class1.cs">
</Compile>
<Compile Include="Class2.cs" />
<Compile Include="Class3.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
</Project
parse the .csproj file using xml and u can delete the others file
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top