Win8.1 -> Win10 experience

My Surface Pro 3 came with Win8 installed, and was greatly improved by the update to Win8.1.

My Win7 desktop computer had enough going wrong that I was tired of trying to fix it; it was old and slow enough that I didn’t mind getting a new computer, complete with 8.1.

Win8 isn’t really great on the desktop computer, so I upgraded the desktop when the helpful (?!) Win10 reminder told me I could.

Continue reading ‘Win8.1 -> Win10 experience’ »

Build Events per Configuration

I probably just overlooked it, or couldn’t figure out how to work it, but it appears that Build Events for a project are not connected to a configuration.

Since I want a “Deploy” config that copies files somewhere after a build, and a “No_Deploy” config that doesn’t, I started digging into the .csproj file.

The Post-build events are in a section that looks like this:

<PropertyGroup>
<PostBuildEvent>
copy $(TargetPath) c:\bin\
</PostBuildEvent>
</PropertyGroup>

Seemed pretty simple to use the Condition attribute on this PropertyGroup item, same as on other PropertyGroup items:

<PropertyGroup Condition=”‘$(Configuration)’ != debug_nodeploy'”>
<PostBuildEvent>
copy $(TargetPath) c:\bin\
</PostBuildEvent>
</PropertyGroup>

Seems to work as expected.  I wonder if VS will overwrite this at some point?

 

PowerShell script to install Custom Gallery for Doc. AutoSave

I got a note regarding the Visual Studio AutoSave extension saying they wished installing it were simpler.  I suspect they were referring to having to set up the custom gallery, rather than being able to get it from the Microsoft gallery.

I’m not ready to put it in the Microsoft gallery yet, so I toggled up a PowerShell script to add the registry key for the needed custom gallery.

This is specific to VS2013, but should be easy to modify for previous versions.

Run the script in a PowerShell console:
C:\> . CBExtensionRegKey.ps1
There is one optional parameter – DisplayName.  The default is “CB Gallery”; this is the name that will display in the list of galleries in VisStudio.

I have run it on Win7 and Win8.1; here are the entries made in the registry:

Registry key and values

Registry key and values

USE AT YOUR OWN RISK!

CBExtensionRegKey  (Rename to .ps1, of course.)

USE AT YOUR OWN RISK!

 

 

Stupid Word copy behavior

I want to copy a UNC path out of a document in Word and paste it in to an Explorer window.
I highlight the text I want to copy like this:

Highlight text to copy

Highlight text to copy

When I paste it, I get:
2) \\corp\xxx\data\xxx\installs\xxxxxxxx\Gateways\Archive

Why the hell was the “2)” included?  I did not highlight that because I did not want to copy it.

Sheesh.

 

Using TagBar and vim with .ini files

One application I work with uses a .ini file with over 30 sections.  I thought it would be handy to ‘outline’ that with tagbar.

In ctags.cnf, add:
–langdef=inifile
–langmap=inifile:.ini
–regex-inifile=/^\[([,&0-9A-Za-z ]+)\]/\1/s,section/
(I am still tuning the regex.  Please leave a comment if you have a better version…)

And in _vimrc:
let g:tagbar_type_dosini = {
\ ‘ctagstype’ : ‘inifile’,
\ ‘kinds’ : [
\ ‘s:section’
\ ]
\ }

In putting this together, I learned that in ‘tagbar_type_zzz‘, the ‘zzz’ is the vim string for a file type.  “:set ft” (in vim) reveals the file type for .ini files is ‘dosini’.

Tagbar lets you toggle between sorting the tags alphabetically and displaying them in the order they appear in the file.

Visual Studio AutoSave extension updated

Added an option to autosave Projects.

See the Utilities page for details.

Possible Issue:  I have been noticing strange behavior with the release build of the package installed in VS2013 running on Win8.1 — the menu text does not update as expected.  The extension works as desired, but it is confusing since the menu text doesn’t change once it is in a certain state.
I have been testing on Win7 and WinServer 2012 R2 (Azure VM!) and have not seen any problems.
I’d appreciate hearing from others that see any sort of unusual behavior…

(The version I have uploaded to the gallery is the release build; I install a debug build manually on my Win8.1 setup.)

Powershell Get-History and Invoke-History

I use Get-History (‘ghy’) and Invoke-History (‘ihy’) frequently, so I started thinking about streamlining their use.

I came up with Run-CmdFromHistory:
function Run-CmdFromHistory {
     param (
        [Parameter(Mandatory=$false)]
        [Int32] $cmdCnt = 15
    )
    $cmds=get-history | select -last $cmdCnt;
    $cmds;

    Write-Host “Enter a cmd id to run (empty to cancel)” -Foreground Yellow;
    $id = Read-Host ” “;
    if([string]::IsNullOrEmpty($id) -eq $false) {
        invoke-history $id;
    }
    else {
        “Canceled.”;
    }
<#

.SYNOPSIS A concatenation of Get-History/Invoke-History in one command. Display last cmdCnt number of commands. Allow user to select by number and run.

.PARAMETER cmdCnt (Optional) Number of commands to display. Default = 15.

#>
}
Set-Alias rch Run-CmdFromHistory -Scope “Global”