473,320 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Macro needed?

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
Nov 21 '05 #1
4 1187
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

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

Nov 21 '05 #2
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

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

Nov 21 '05 #3
Many Thanks

Just what I was looking for.

Regards
Tim


"Gary Chang[MSFT]" <v-******@online.microsoft.com> wrote in message
news:Ef**************@cpmsftngxa10.phx.gbl...
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

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

Nov 21 '05 #4
OK, Tim, I am very glad to know my code works for you!
Good Luck!

Best regards,

Gary Chang
Microsoft Online Partner Support

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

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Donald 'Paddy' McCarthy | last post by:
So, for those that don't actively not-want a Python macro facility. If we are to have it what should it do? 1) Macro definitions should allow Doc strings. 2) There should be a separate statement...
6
by: MLH | last post by:
Did A97, perchance, do away with the need for an AutoExec macro to initiate an autoexec sequence for databases? Or, must we still suffer with that hideous macro?
17
by: sounak | last post by:
How could we get a macro name from a macro value such that in a header file #define a 100 #define b 200 now the source file will be such that the user gives 100 then the value is outputted as...
6
by: Takeadoe | last post by:
Dear NG, Can someone assist me with writing the little code that is needed to run an update table query each time the database is opened? From what I've been able to glean from this group, the...
33
by: Peng Yu | last post by:
Hi, __PRETTY_FUNCTION__ is a macro that gives function name, etc. I'm wondering if there is a macro to get the class name inside a member function. Thanks, Peng
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.