views:

32

answers:

1

Is it possible to write a macro or plugin for VS.NEt 2008 to display a list of files in a project that are writeable? I run into this problem when working with Source Safe. There are many times where there is file contention causing me to mark a file as writable to make changes. It would be nice to devise a solution for displaying such a list in VS.NET

A: 

I know you're looking for VS2008 but I don't have that on this machine.

In VS 2010 this worked for me:

Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.IO

Public Module RecordingModule

    Sub DisplayMessage()
        Dim solution As Solution = DTE.Solution

        Dim files As String

        Dim file As ProjectItem
        For Each prj As Project In solution.Projects
            For Each file In prj.ProjectItems
                Dim fi = New FileInfo(file.FileNames(0))
                If fi.IsReadOnly = True Then
                    files = files & Environment.NewLine & fi.FullName
                End If

            Next
        Next
        MessageBox.Show(IIf(String.IsNullOrEmpty(files), "No files", files))
    End Sub


End Module

I got most of the code from http://stackoverflow.com/questions/415101/need-visual-studio-macro-to-add-banner-to-all-c-files

Preet Sangha