Hi
I wish to automatically fill in the assembly attributes (i.e <Assembly:
AssemblyTitle("")> etc) in my assembly.vb files in serveral projects in my
solution. Is there a way of doing this, perhaps with a macro?
Regards
Tim
Gary Chang[MSFT] - 29 Oct 2004 06:58 GMT
Hi Tim,
>Is there a way of doing this, perhaps with a macro?
If you want to play it with a VS.NET IDE Macro, maybe you can take a try on
Edit.Find/Replace function:
Sub SetAssemblyTitle()
Dim prj As Project
Dim file As ProjectItem
Dim AssemblyTitle As String
For Each prj In DTE.Solution.Projects
For Each file In prj.ProjectItems
If file.Name = "AssemblyInfo.vb" Then
file.Document.Activate()
DTE.ExecuteCommand("Edit.Find")
DTE.Windows.Item("AssemblyInfo.vb").Activate()
DTE.Find.Action = vsFindAction.vsFindActionReplace
DTE.Find.FindWhat = "<Assembly: AssemblyTitle("""")>"
Select Case prj.Name
Case "Project1"
AssemblyTitle = "MyApp1" 'Set your assembly
title here
Case "TProject1"
AssemblyTitle = "MyApp12"
'...
'...
End Select
DTE.Find.ReplaceWith = "<Assembly: AssemblyTitle(""" +
AssemblyTitle + """)>"
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = True
DTE.Find.MatchWholeWord = True
DTE.Find.Backwards = False
DTE.Find.MatchInHiddenText = False
DTE.Find.PatternSyntax =
vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.Action = vsFindAction.vsFindActionReplace
DTE.Find.Execute()
DTE.Find.Execute()
DTE.Windows.Item(Constants.vsWindowKindFindReplace).Close()
DTE.ActiveDocument.Save()
file.Document.Close()
End If
Next
Next
End Sub
Wish it helps!
Best regards,
Gary Chang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Gary Chang[MSFT] - 29 Oct 2004 07:12 GMT
Hi Tim,
By the way, if you just want the project's name as your assembly title, you
can simplify the code as :
'Delete the Select Case code block and modify the following code with
DTE.Find.ReplaceWith = "<Assembly: AssemblyTitle(""" + prj.Name + """)>"
Thanks!
Best regards,
Gary Chang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Tim Marsden - 29 Oct 2004 10:46 GMT
Many Thanks
Just what I was looking for.
Regards
Tim
> Hi Tim,
>
[quoted text clipped - 14 lines]
> This posting is provided "AS IS" with no warranties, and confers no rights.
> --------------------
Gary Chang[MSFT] - 30 Oct 2004 03:29 GMT
OK, Tim, I am very glad to know my code works for you!
Good Luck!
Best regards,
Gary Chang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------