Welcome to MSDN Blogs Sign in | Join | Help

“Pasting” attachments to work items in Visual Studio

Today I deleted my CodePlex project TfsPasteAttachment

It was (up until today) located @ http://tfspasteattachment.codeplex.com/

Since the functionality had been removed from the product during Whidbey, the codeplex project was an add-in that added it back for people still using Visual Studio (more specifically, Team Explorer) 2005.  However, since the functionality went back in with Orcas (TFS 2008) and that’s been out so long, there’s not much reason to keep that project around any longer.

I had added it back during the Whidbey development cycle to scratch my own itch – I was filing lots of bugs during our bug bashes, but I got sick of how much time it took me to get screenshots or logs attached to the bugs I was filing (bugs filed without logs/screenshots/etc make me quite sad).  Back then you didn’t bug bash on your own machine (mainly due to the 2.0 CLR being still a work in progress at the time and the logistics around that – this was before Hyper-V :), but TS’d into a remote machine (very remote for those of us in North Carolina! :) – since it was remote, I even noticed people that didn’t know about mstsc’s clipboard-transfer capabilities saving files on the remote machine then copying them to their desktop machine to attach to the new bug (ouch!)

Getting the data I wanted to attach to the bug into the clipboard was pretty simple:

During my existing bug filing, I found I would either paste the file(s) to my desktop and attach them from there or for text or image data I’d open notepad or mspaint, respectively, paste it in, save it to a file on my desktop, and then attach that file (then delete the file after I had saved the attachment to the work item).  Lots of manual work, unfortunately, and if I forgot to delete them, random temp files laying around my desktop.

So the question was then “How do I get this data from the clipboard into an attachment on the work item with less steps?”

The clipboard part ended up being ridiculously easy thanks to the great static methods available in the BCL’s Clipboard class.

The other part, getting it onto the work items, was pretty straightforward as well thanks to the Attachments property off of WorkItem.  The rest of the code (hooking into the attachments UI control, for instance) was also straightforward thanks to help from Jason Prickett who was on the Work Item team at the time (and right down the hall!).

To use

As you’d expect, the user interaction is that of “pasting” (control-v by default) into the attachment control.  You can do this with files (1 or more), text, or image data in your clipboard and it’ll attach it to the work item.  In addition, for the particular case of files you can drag-drop them as well.

Adding files (this via control-v of files that I control-c’d in Explorer)

image

Adding text (this via control-v of text that I control-c’d in notepad)

image

Adding screen shots (this via control-v of an image that I captured via Win+S with OneNote – incidentally, that’s also how I make the screen captures for blog posts)

image

Posted by jmanning | 3 Comments

Sending feedback about “Send Feedback”

[EDIT: found the relevant blog post which points to the instructions MSDN subscribers have to use, so I can now use the Send Feedback links :)]

It was a little disconcerting that I can’t even successfully send feedback.  Now, I’d be happy to report that I had a failure trying to send feedback, but where’s the link for that? :)  Back to manually filing a bug, I guess :)

image

Posted by jmanning | 0 Comments

Having to uninstall PowerShell (still) makes me sad

This isn’t new to Windows 7 (I got the same when upgrading from XP to Vista).  However, it still feels like we’re “punishing” one of the user subsections that don’t deserve it (especially since I’m in it! :)  Trust me, I “get” that it’s not a very populous subsection (unfortunately :) so on the list of priorities, a “bug” like this is likely to be pretty far down the list (especially given the workaround, making the severity pretty low too!  Of course, I’m with Joel on the uselessness of that field but that’s a rant for another day)

image

To compound the pain, the above instructions aren’t even correct.  PowerShell is part of the OS in Vista (it installs with CBS, not MSI), even if it’s not “in-box”, so you have to go “turn off” PowerShell – it’s not a regular program you would uninstall as the compatibility report seems to indicate.

image

I’ll hold out hope that it’ll be better by RTM!

It does raise a related question, though: What’s the opposite of a Snoopy Dance?

Posted by jmanning | 0 Comments

upgrading to SP1 fixes VM Additions for Win7 Beta!

Many thanks to reader ajcg whose comment in my previous post was spot-on.  Once I upgraded VPC 2007 to SP1, then the Virtual Machine Additions version that got installed into the guest (Win7) was 13.820 which was recent enough to work on Win7! Yay!  More recent versions of VM Additions should work as well, but 13.820 seems to be the latest I can find externally.

Incidentally, once I searched on 13.820 I noticed a comment left by MikeH2005 that confirms the SP1 update of Virtual Server 2005 R2 includes the same 13.820 version (and is what's needed for Win7), so if you're running Virtual Server, then SP1 should fix you up as well.

Download links to get the SP1 updates:

image

Posted by jmanning | 1 Comments

Windows 7: fully de-Hitler'd

(note to those that it's not obvious to: this is a joke... laugh!)

It turns out this xkcd comic is a little behind the times - we de-Hitler'd over 5 years ago!

Posted by jmanning | 1 Comments

Windows 7 + Alpha Squad 7 = overload o' awesome

Clearly someone on the Win7 team is a fan of Colbert's comic! ;)  At least, that's my theory and I'm sticking to it until Tek himself says otherwise! :)

 

 

 

image

Posted by jmanning | 1 Comments

Windows 7 Beta in Virtual PC 2007 - BSOD in Fs_Rec.sys after adding VM Additions

EDIT: UPDATE: SP1 fixes this!  Yay!!!

Others seem to have run it with no problems, and I installed it and ran fine (installed the update as well, even though there wouldn't be any mp3 files on that VM).  However, attempting to install the VM Additions (VPC 6.0.156.0) resulted in a busted driver.

image

Bonus points if you happened to notice that incorrect use of "it's" instead of "its" in the highlighted error message.

I'm not the only one hitting it, at least... but as I type this, it's the only hit by my search.

http://betaarchive.com/forum/viewtopic.php?f=32&t=6664

Since others at least claim to have it working under VPC 2007 fine, I'm not sure what's different about ours (host OS for me is up-to-date Vista), but for now I'm having to stick without VM Additions (System Restore worked great! :), which is pretty painful.

Since I have to System Restore in order to get back to bootable, I'm guessing the relevant memory dump / WER data isn't getting sent, but I haven't dug into that as of yet.

Posted by jmanning | 8 Comments

PowerShell V2: CTP3 now available!

  • Sea
  • Tea
  • Pea
  • Three
  • Whee!

Go get it!

The bits in the overview I want to call out (because I've seen others trip over this) -

  • In Windows PowerShell V2 CTP, the WS-Management-based remoting features work correctly only on Windows Vista with Service Pack 1 (SP1) and on Windows Server 2008. These remoting features will not work on Windows XP and Windows Server 2003 in this release.
  • Windows PowerShell background jobs (jobs) rely on the remoting features of Windows PowerShell V2. To use jobs, Windows PowerShell remoting must be enabled, even if the job runs only on the local computer.
  • Many features introduced in previous CTPs were modified based upon customer feedback. If your scripts used those features, they may have to be modified to run properly. A list of the changes is provided in the Release Notes.

You really want to play with the jobs support.  Before I started playing with it, I expected something akin to job control from bash (and many other shells), but it's much more than that - among other things, its built-in support for running jobs remotely and throttling.  Check out this post from MoW for an example.

If you're new to PowerShell V2's remoting, you may also want to read Don Jones'  article and Krishna's blog post for a quick conceptual overview.

Posted by jmanning | 1 Comments

powershell one-liner to expose some emoticons

While chatting with a co-worker about a bug I had fixed a few weeks back, Communicator unexpectedly (to me) translated (I) into an emoticon for me (I know, I can turn emoticons off).

So, time for a quickie one-liner and then paste the resulting text into the IM window to see what the alphabet emoticons are:

image

Note that it's a little annoying (again, to me) that I can't do char ranges (at least with V1) that I can do with something like perl (and many other languages)

# perl -le "print 'A'..'Z'"
ABCDEFGHIJKLMNOPQRSTUVWXYZ

# 'A'..'Z' | %{ '( {0} ) == ({0})' -f $_ }
Cannot convert value "A" to type "System.Int32". Error: "Input string was not in a correct format."
At line:1 char:6
+ 'A'..' <<<< Z' | %{ '( {0} ) == ({0})' -f $_ }

Posted by jmanning | 0 Comments

pet peeve: full-screen + multi-monitor

I'm noticing silverlight pick up a behavior from flash that I don't like: kicking out of full-screen when there's a click on the other monitor (or other loss of focus from the plugin).  Now, if it's full-screen and there's only 1 monitor, then I guess that's fine.  But in my case, I'm working/clicking on another monitor, but it still exits the full-screen.  That's annoying.

Flash does this for me on sites like Hulu where I typically want to throw up last night's Colbert Report on a monitor while continuing to work on a second monitor.  No luck, though - any actual clicking after clicking full-screen (like, to shift focus back to another app) kills the full-screen.

Same for silverlight, unfortunately.  For instance, hitting the Getting Started video, I wanted to have it full-screen on one monitor and play around with silverlight in VS on the other.

In the silverlight case, at least, the video is also available in other formats, so I can open the wmv version in WMP, either standalone or in the browser (so any argument of "browser plugins can't shouldn't behave that way" is gone, IMHO) and at least *that* app doesn't exit full-screen when other things are done on another monitor.

It's almost 2009 people!  Let's have some more love for multi-monitor setups!  Silverlight 2.0 having this behavior really strikes me as odd (and a little disappointing).  Maybe the key Silverlight people are all rocking laptops and don't have this problem like I do :)

Are others hating this behavior like I am?  Sure.  Enough to change the behavior?  Given how long Flash has called this By Design, I'm not very hopeful for that plugin, but maybe Silverlight can at least change, although since 2.0 has already shipped, it'll probably be awhile even if it does :)

Don't get me wrong - there are plenty of other offenders in this bucket (DreamScene, for instance, pauses on all monitors when there's a window is maximized on any of them), but Flash and Silverlight are the ones that cause me the most daily pain :)

Posted by jmanning | 1 Comments

Common confusion - "Reporting Services Data Source Account" != account Reporting Services is running as

A few of us were working just this morning on trying to prevent this confusion in the next version, so it seems like a decent time for a blog post. 

When the TFS 2008 (and 2005 for that matter) setup is asking for "Reporting Services Data Source Account", it's not asking for the account the Reporting Services itself is running as.  TFS doesn't need to know (and doesn't care) what account RS itself is running as.  Most of the time if you accept the defaults it'll be Network Service, but TFS really doesn't care.

Going top-down on the explanation:

  • TFS includes lots of reports which (by default) get created as part of each team project you create. 
    • These reports are full of goodness like work item info, code churn data, etc.
  • For these reports to actually get the data that populate into these wonderful pictures and charts, they associate themselves with one more more Data Sources.
    • It's a relatively simple level of indirection.  Reports get data from Data Sources, and then the Data Sources in term define how to get the actual data.
    • You can have Data Sources that pull from all kinds of places, including things like spreadsheets, xml files, databases, etc.
  • When TFS installs, we create 2 of these Data Sources.
    • TfsReportsDS points at our "relational warehouse"
      • this relational database (called TfsWarehouse) where we gather lots of data from the other "operational" databases (like TfsVersionControl, TfsWorkItemTracking, etc)
    • TfsOlapReportsDS points at our "analysis warehouse"
      • This database is also called TfsWarehouse (which can cause some confusion in itself) and is located inside an instance of SQL Analysis Services.  Inside it is a cube called TeamSystem that keeps the same kinds of information as the relational warehouse.
      • This cube actually gets its data solely from the relational warehouse, by default processing new data once an hour.
  • These data sources, which connect to a relational database and analysis database respectively, have credentials associated with them.
    • This way, we can control the credentials that the data sources "run as" and can then control the account we have to grant read permission to the relational and analysis warehouses.

The field "Reporting Services Data Source Account" is asking for the account/password you want to use for the credentials inside these 2 data sources we're going to create in Reporting Services.

To reiterate, it's 100% unrelated to whatever account Reporting Services itself is running as.  We (TFS) don't know and don't care what RS is running as :)

Posted by jmanning | 2 Comments

powershell script - find orphaned C# files

I ran across a C# file that had been removed from its csproj file, but it hadn't been deleted from version control.  So I wrote a script (Chris Sidi had already written one, though) to find the .cs files that weren't in the "containing" .csproj file

 

param([string]$csproj = $(throw 'csproj file is required'))

$csproj = Resolve-Path $csproj
$dir = Split-Path $csproj

# get the files that are included in compilation
$xml = [xml](Get-Content $csproj)
$files_from_csproj = $xml.project.itemgroup | 
	%{ $_.Compile } | 
	%{ $_.Include } |
	?{ $_ } | 
	%{ Join-Path $dir $_ } |
	Sort-Object

# get the files from the dir
$files_from_dir = Get-ChildItem $dir -Recurse -Filter *.cs |
	%{ $_.FullName } |
	Sort-Object
	
Compare-Object $files_from_csproj $files_from_dir
Posted by jmanning | 3 Comments

macro to "organize usings" for a project

I won't claim this is efficient, or well-written, or whatever, but it WorksForMe and I figured I'd share.  Feel free to post better versions in the comments or on your own blog and add a link as a comment :)

Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics

Public Module RemoveAndSortModule
    Sub RemoveAndSortAll()
        IterateFiles()
    End Sub

    Private Sub IterateFiles()
        Dim project As Project
        Dim projectObjects As Object()
        Dim window As Window
        Dim target As Object

        window = DTE.Windows.Item(Constants.vsWindowKindCommandWindow)
        projectObjects = DTE.ActiveSolutionProjects
        If projectObjects.Length = 0 Then
            Exit Sub
        End If
        project = DTE.ActiveSolutionProjects(0)
        RemoveAndSortFiles(project.ProjectItems())
    End Sub

    Private Sub RemoveAndSortFiles(ByVal items)
        Dim file As ProjectItem
        For Each file In items
            DTE.ExecuteCommand("View.SolutionExplorer")
            If file.Name.EndsWith(".cs") Then
                file.Open()
                file.Document.Activate()
                DTE.ExecuteCommand("View.ViewCode")

                DTE.ExecuteCommand("Edit.RemoveAndSort")

                file.Document.Save()
                file.Document.Close()
            End If
            If file.ProjectItems().Count > 0 Then
                RemoveAndSortFiles(file.ProjectItems())
            End If
        Next
    End Sub
End Module
Posted by jmanning | 1 Comments

Enterprise Edition

What's your favorite?

 

Chris Rathjen‎‎ [9:05 AM]:

i take it you want enterprise?

‎‎James Manning‎‎ [9:05 AM]:

NCC-1701 *D* please

‎‎Chris Rathjen‎‎ [9:05 AM]:

dude the E kicks the D's ass

‎‎James Manning‎‎ [9:06 AM]:

yeah, it does

but D has more sentimental value to me

‎‎Chris Rathjen‎‎ [9:06 AM]:

true true

Posted by jmanning | 1 Comments

collection and property initializers are so nice

I happened to change a piece of code over the weekend and used both.  It's a tiny piece of code, so I thought it would make a good example of just how much readable code is using them.

Before:

List<Property> p = new List<Property>(1);
Property pr = new Property();
pr.Name = "Description";
pr.Value = Description;
p.Add(pr);

After:

List<Property> properties = new List<Property>()
{
    new Property() { Name = "Description", Value = Description },
};

Ah, much nicer.  (Yes, technically the second doesn't get the list size set to 1 like the first does, but I consider that a micro-optimization in the first place).

Remember, focus on making code easier to *read*, not easier to write.  That's one of the reasons I don't use "var" above, even though it causes a DRY failure - I like not having to read past the "=" to get the type.  Also, I like not having some locals that have the type out front and some that don't.  However, that's really for a different post, so nevermind. :)

Posted by jmanning | 1 Comments
More Posts Next page »
 
Page view tracker