Add current date and developer name to method header - visual-studio-2010

I am using Visual Studio 2010, on a Windows 8 system. I would like to change the auto-generated method header to include the developer name and current date to maintain header consistency with existing code. In other words, I would like the header to resemble something like the following:
''' Author.........: John Doe
''' Created........: 2/15/2007 2:25:30 PM
''' <summary>
'''
''' </summary>
''' <remarks></remarks>
I have tried to find out how to do this, and it seems that I need to edit a file located somewhere in the following directory: C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates but I have not been able to find a zipped folder that contains the method header file.
Am I looking in the correct place? What is the container's name I am supposed to be looking for? Finally, when I do find it, what do I need to add to make the date auto-generated for today's date?
Any assistance would be greatly appreciated.

I finally decided to install GhostDoc, which can be downloaded from here. It is not exactly the solution that I was looking for, but it was close enough.

Related

Disable Visual Studio's validation of non xml files that look like xml?

This is a repeat of a question asked by someone else way back in 2008
, but it appears there was no real answer back then and this is still a problem.
I am writing a Visual Studio extension for files which look like XML but are not, and do not end in an xml extension. (I am using .csp) However Visual Studio continues to parse and highlight the file as if it was XML. This makes it difficult to get my own parsing and error processing to work.
Is there any way to programmatically tell visual studio that the file is not XML?
See also similar issue on MS forum
Since you have your own file extension, yes there is! It's simply a matter of editor priority. The XML-sniffer editor is only given a chance to claim the file if nobody else with higher priority does so first. It does so by registering the special * file extension as editable, then grabbing the file if it looks like XML -- but that * extension registration only has a priority of 33.
All you need to do is make sure your editor is registered properly with a higher priority. On your package, make sure you have the ProvideEditorExtension attribute. I suggest a priority of 50 to start with (higher numbers have higher priority).
[ProvideEditorExtension(typeof(CspEditorFactory), ".csp", 50)]
If you don't already have an editor factory, there's a good walkthrough on MSDN about how to create one.

Finding the path to file using application startuppath in a windows form

Hi every one I am trying to access a file in certain folder in my windows form app, but I keep getting the error "could not find a part of the path: C:....e.t.c".
here is my code:
string doc = Application.StartupPath + #"\filefolder\pin-card02.docx";
please what is wrong with this piece of code?
I have seen some explanations but nothing tells me how to direct my program to a certain file in a folder...
Thanks in Advance
There's probably nothing wrong with this piece of code, most likely this file is not set as content of your application and is not getting copied to the output directory, if this is part of a visual studio solution, check that pin-card02.docx has "copy to output directory" set to "Always" or "Copy if newer" in the .doc's properties, if it's not part of the solution, you may need to include it and set the property.
If this doesn't help, you'll need to provide more information on the problem.

Visual Studio Installer: How to make app.config a hidden file if I choose to add primary output instead of individual files?

Basically, I created a Visual Studio Installer project. I added a primary output to my project, which was great because it loaded in the dependencies and files automatically for me. The problem I'm facing is that I want to be able to mark my config file as a hidden file, but can't seem to figure out how.
When I go to View>File System it lists:
MyExternalAssembly.dll
Primary output from MyProject (Active)
So, is there a way to actually mark my config file as hidden during installation if I add a primary output project instead of the individual files?
I'm not sure if you really want to make it hidden. If you're worried about users looking at it, a more than average user will know how to un-hide things and pilfer around. So, that being said, if you want to keep users from seeing what's in the config you will need to encrypt the config. A good example of that can be found here:
http://www.davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx
If you still want to hide the config, then you could try hiding it once the application is run for the first time.
Using: ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun with a click once application you can tell if this is the first time an application is run.
You could then use File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); to actually hide the app.config.
Which would result in:
if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun)
{
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
}

How to show files being copied, moved,etc. on installer screen using WIX

I have my installer and is working fine.
What I want to add more is that I want to show the work done by installer on installer screen (Example, installing Microsoft SQL Server 2005, we get the files being copied, moved, registry entry created,......)
Similarly I want to show this on my installer.
So can anyone help me on this to how to show all these at runtime on installer screen.
Thanks,
Sunil
Just copying my answer to the same question on wix-users list:
Use ProgressText element.
The 'Template' attribute is the place to put tokens to reflect the progress. See the standard InstallFiles action for example.
The table "ActionData messages" lists the possible tokens for this action.
Sample:
<ProgressText Action="InstallFiles" Template="File: [9][1]">!(loc.InstallFilesActionText)</ProgressText>
Outputs:
File: C:\Program Files\MyApp\bin\my.dll
etc.
Hope this helps,

Is there something like Emacs' toggle-read-only in Visual Studio?

The subject says it all. Is there an easy way to toggle the editability of a buffer in Visual Studio? This would be similar to the toggle-read-only command in Emacs.
I am not looking to change the file attribute ... just whether I can edit the file while it is open in Visual Studio. I am using 2008 and 2005.
Why would I want to do this? I tend to have several files open at the same time .... for days at a time sometimes (perhaps a bad habit) and I have +/- a char or few here and there without meaning to or noticing ... also worried about "the cat walking across the keyboard"
Besides ... an "ancient" code editor like emacs has it :) and I grew to expect the feature.
TIA!
There is an extension for Visual Studio called CodeMaid that will give you a Read-Only Toggle per file.
http://www.codemaid.net/documentation/#andmore
You can download it at http://visualstudiogallery.msdn.microsoft.com/76293c4d-8c16-4f4a-aee6-21f83a571496
You can use this piece of vba
Public Sub ToggleReadOnly()
Dim doc As Document
doc = DTE.ActiveDocument
If (doc.ReadOnly) Then
doc.ReadOnly = False
Else
doc.ReadOnly = True
End If
End Sub
Note: the msdn documentation specifically mentions that the property ReadOnly shouldn't' be used explicit but I verified that this works for me on vs.net 2005.
I also verified that the actual file attribute isn't changed.
I'm not aware of anything that will quickly achieve what you're looking for. Furthermore, I'm not really sure why you would need such a thing. Typically I use subversion to tell me which files have been changed and where they have been modified that way I can revert anything that doesn't belong.
Can you expand on your question a little to let us know what your usecase is?
If you really need to toggle readonly....perhaps you can:
Right click on the file
Select Open Containing Folder
Right click on the file and choose properties
Check the readonly checkbox
Start Tools->Macros->Macro IDE. Add new module (described here in details) and define there procedure as follows:
Imports EnvDTE
Public Sub SwitchReadOnly()
DTE.ActiveDocument.ReadOnly = Not DTE.ActiveDocument.ReadOnly
End Sub
Assign macro to keyboard key(described here in details). That's all.

Resources