January 8th, 2012
Sparked by a long wish for keeping my Visual Studio extensions and settings in sync across multiple computers, and a discussion with @kellabyte and @ackenpacken yesterday, I started to research how this could be done.
With a quick Google search, I found this blog post by the Visual Studio team, describing where Visual Studio 2010 looks for its extensions. The blog post specified \Common7\IDE\devenv.pkgdef as the file to modify in order to load extensions from additional places than the default ones you get “out of the box”. Further down in the blog post, PkgDefSearchPath was listed, and it seemed like a good to add a folder controlled by Dropbox. On my computers, this would typically be C:\Users\larsw\Dropbox\Visual Studio Settings and Extensions.
Before you start poking around in the file, I suggest you take a backup of the original one, in case of any f*ckups. As you can see from the default entry, it contains three paths in a semi colon separated list. I just apppended my chosen folder to the end of this list like:
C:\Users\larsw\Dropbox\Visual Studio Settings and Extensions”
Before you start editing the file, I suggest you shut down all instances of Visual Studio, so the likelihood that the file won’t be write-protected or changed is minimal.
Migrating existing extensions
In the same pkgdef file, UserExtensionsRootFolder points at the default location for user-defined extensions – in my case, it points to c:\Users\larsw\AppData\Local\Microsoft\VisualStudio\10.0\Extensions. I chose to move all the sub folders (containing extensions) into my newly created Visual Studio Settings and Extensions folder controlled by Dropbox. As for the extensions located in the folder defined by ApplicationExtensionsFolder, I chose to let them be for know, because I suspect that they are having dependencies on native components etc. There were a lot of Microsoft default extensions, as well as JetBrains Resharper etc. located in the folder.
On my other computers, I had to update the same pkgdef file, let Dropbox sync the folder, start Visual Studio – & voila! The same extensions were present
As for Visual Studio settings, it’s a supported functionality out of the box to share settings between Visual Studio instances across machines via (typically) a file share. The same functionality can of course be used with Dropbox. Go to Tools –> Options –> Environment –> Import and Export Settings, and point to a location inside the same Dropbox-controlled folder.
October 1st, 2011
The System.Security.Cryptography.Xml namespace has been there since the dawn of time, and the look and feel of the API is rough at best. To top that, the MSDN documentation isn’t really something to lean on either, and it’s been a long, long time since I last tried to get acquainted with it.
I’ve done some work to integrate Windows Identity Foundation (WIF) with the ESB we’re using at work, and I wanted to implement message security (encryption and signing). Since the messages are XML-based, and that I really didn’t want any homegrown security solutions, I found it natural to use EncryptedXml and SignedXml from the aforementioned namespace to do the job. My weapon of choice was x509 certificates and the proof-of-possession key (AES-256-CBC) from the SAML 1.1 token issued by the STS, and by tweaking the EncryptedXml configuration, I managed to massage the information about the x509 key down to a bare minimum (to keep the message size down).
Now, creating the detached signature on the publisher side was a no-brainer as well, but on the other end of the “cable” I wasn’t able to verify the signature. I tried “everything”, but to no avail. I bugged Barry Dorrans (@blowdart) on Twitter, since he’s as a guy that knows “a thing or two” about .NET Security. Barry had a couple of pointers, but none that resolved my issue.
So, weaponed with the .NET Reflector and some moral support from Barry via email, I started to dig into the System.Security assembly. It reeks of all sorts of code smells, and it took a while before I found the piece of information I was looking for:
Using SignedXml.CheckSignature() w/o sending in an X509Certificate2 instance explicitly, will only look in Current User\Other People or Local Machine\Other People. Be aware that Other People is an alias for AddressBook too.
September 19th, 2011
First of all; credits for this solution goes to a former colleague, and now a contractor working in my department; Erlend Rotvik of WebStep Fokus.
The title might be a bit cryptic, so let me elaborate a bit on the subject; until last week or so, it was “common knowledge” that using the NetMsmqActivator together with Queued WCF services hosted in different IIS7 sites was a no-go. The reason for this “truth” was that there wasn’t a way to specify how the NetMsmqActivator should dispatch messages to the different IIS sites.
If you experience exceptions like this one:
or get this one in your face unexpectedly:
you’ve probably being screwed by the NetMsmqActivator with wrong binding information set.
When you set up an net.msmq on your IIS7 site, the binding information you enter is normally localhost, so Erlend played a bit with the syntax and found out that if he used an asterisk (*) he could filter on specific queues. Since we prefix all MSMQ queues based on the project / services they belong to, he tried to put the prefix before the asterisk – and lo and behold; now the NetMsmqActivator only dispatched messages from the queues that matched the prefix! As far as I know, this isn’t documented, so head over to a local IIS7 installation of yours and try it out!
Example binding information:
would tell the NetMsmqDispatcher to only dispatch messages in queues named MySite.* to the given IIS Web Site.
November 5th, 2010
NoWhen I first heard about the new async functionality in C# at PDC 2010 last week, my immediate reaction was; how can this be used to ease the development of asynchronous WCF/WF services (and clients).
Well, it turns out that someone on Microsoft has thought about the same thing; in the samples that accompanies the recently released C# async CTP, there’s a sample named (C# WCF) Stock Quotes. This picked my interest, and lo and behold; when I opened up the solution, I immediately noticed the TaskWsdlImportExtension.
Basically, the project contains an extension to WCF that plugs into the WSDL import pipeline, and customizes the output of the generated code you get when you use the Add Service Reference functionality (ASR) in Visual Studio. Now, I have to admit that I’m not the greatest fan of ASR and I normally write my own clients instead, but you can get the extension importer to work with svcutil.exe on the command line as well by pointing to a app.config wiring up the extension with the /SvcutilConfig:<file> parameter (or creating file named exactly Svcutil.exe.config in the same directory as you are doing the import in). More information can it can be found in the WSDL Import section in this MSDN article.
With this extension wired up, the C# client proxy code that is generated looks like this:
Now, that looks kinda complicated – and it is, but you don’t really need to understand what is to start using it. Since System.Threading.Tasks is a new feature in .NET 4.0, there is really nothing that stops you from using the extension right away – it doesn’t rely on the async/await keywords that we’ll see in C# vNext!
Now, if Microsoft hasn’t thought of it already; it would be nice to see a similar way of using System.Threading.Task/C# async in the implementation as well. I’m guessing it wouldn’t be too hard to create and it would probably involve a custom
dispatcher invoker that would replace the default dispatcher in WCF (hint; I’m looking into this now).
June 22nd, 2010
…at least when it comes to handling of decimal numbers – and it probably goes for all other non-English locales that doesn’t use period as the decimal delimiter. If you look closely at the screenshots below, you’ll notice that I’ve entered 2500,00 – that is two thousand comma zero zero in Norwegian. 250000 – two hundred and fifty thousand - gets generated in the SOAP request. If I try to enter 2500.00 (with a period as the delimiter) the UI validation logic tells me (correctly) that it’s an invalid number. Switching to the en-US locale in the Regional settings in Windows, and it behaves normally (e.g. input 2500.00 – output 2500.00 in the SOAP message).
June 9th, 2010
I’ve compiled a list of bloggers who seem to focus on WF4.0. Please post a comment if you have any blogs I’ve missed.
June 3rd, 2010
Now, the title is a bit cryptic, so let me elaborate; earlier this week, I noticed that when I tried to add a service reference to a WCF Workflow service in the same ASP.NET Web Application, I didn’t get the expected result; custom activities for the service operations in the toolbox (when designing another WF Service).
Investigating further, I created a Workflow Console Application and checked if I got the same behavior; no – it worked perfectly. Same happened when I tried it with WCF Workflow Service Application / Declarative Service Library (Visual Studio templates).
Putting one and one together, I guessed that it had something about the definition of the project template. Visual Studio projects has a concept of ProjectTypeGuids that enables/disables specific features for a project once added. A couple of years ago, I noticed that I had to add a specific GUID in order to wire in the “F5 experience” when debugging WCF libraries.
When comparing the GUIDs set in one of the working projects with the ones in the ASP.NET Web Application, I noticed the following (magic number):
I retrofitted the GUID in the Web Application, added a service reference to a workflow service;
Building the project and presto! — custom activities for the service operations in the toolbox.
Now, this isn’t just a problem that can happen when using Workflow Services, it can also happen (as I’ve already mentioned) to WCF projects, test project et cetera too. My suggestion to Microsoft is that they in the future add an section somewhere in the Options pages where it is possible to turn on/off features like this one, so developers don’t need to turn autistic and start remembering a large set of project type GUIDs :-) (Oh, no offense to devs (or others) that actually are autistic).
Thanks @mwinkle for putting me in touch with the Add Service Reference guys, even though I found the workaround first :-)
May 5th, 2010
Recently, we upgraded our Team Foundation Server from 2008 to 2010 at work. Long overdue getting rid off some custom TFS Project templates, we were eager to use the new MSF for Agile 5.0 template. Now, we knew on beforehand that we couldn’t just upgrade existing team projects, so we had to come up with a migration plan.
First, we copied the Team Project Collection and “archived” a copy (NNN_Archive). Next, we created a dummy TFS Project with a Source Control root folder, and moved all the source code from all the existing projects into it. Next up, we created new team projects based on the aforementioned project template, and moved the source code back into the right folders in the VC tree.
Warning: We believed that doing it this way, we would preserve the VC history. Bummer! It did not! But since we had the archived TFS collection, we decided we didn’t want to revert to the backup, but just change to the other collection if we need to check the VC history in the future.
Next off, our architect and scrum masters wanted to migrate the work items from the archived collection to the new projects, so I had to brush off the dust of my TFS API skills and create a piece of throw-away code that would do the job.
Now, instead of just throwing away the code, I’m guessing that other people might need to do the same thing, so I’ve shared the source here.
You will have to tweak the source code to get it to work; the SOURCE_COLLECTION and TARGET_COLLECTION uri’s need to be set, as well as the TargetProjectName.
You will also have to tweak the WIQL query to return the work items you want to migrate – if you’re up for it, it shouldn’t be too hard to generalize the utility so that it would read the variables including the wiql from a configuration file.
Next up, you will have to adjust the MigrateWorkItem() method so that it copies the correct fields (optionally mapping to other field types in the new WI schema). The source code will copy attatchments – something that you also probably want to do. If you use the Links tab today, you will have to code up something that will lift over the links as well.
When you start the utility, you will be prompted with:
“Create [A]reas/Iterations or [M]igrate (Ctrl-C to quit)?:
The reason I did it this way, is that if you create the areas/iterations in the same pass as the work items, you will have to pause execution (Thread.Sleep) to ensure that the items has been commited to the TFS before the Work item is saved – IMO the two-pass strategy is cleaner.
Hope someone can reuse the code,
November 9th, 2009
In the first installment of this pre-PDC blog post series, I published the list of the sessions I’ll likely attend and a list of sessions that would be cool to see, but that isn’t really target material (for me).
Microsoft has now published the time & location of each session, and I must say that I’m (at least at the moment) quite disappointed that www.microsoftpdc.com lacks two important features:
- Export to Outlook / ICS. Both for single sessions and the possibility to link the whole My Sessions view into Outlook.
- An Outlook-ish calendar view, that visualize conflicting sessions (Just like my normal Outlook calendar – when my coworkers book me for three different meetings at the same time ;-) ).
That said, I hope Microsoft hasn’t revealed all features of the PDC website yet.
Since I haven’t found the floor map for LACC on www.microsoftpdc.com (yet), I’ve scanned the floor plans from PDC ‘08. Click the picture to bring up a larger version. Note that the layout of stands/booths in the Expo area are probably different from what it will be this year.
Since it’s getting closer to my departure, I’ll put up a list of stuff I’m bringing both for the trip and stay – hopefully, there may be a trick or two for a first-timer travelling to a large conference.
- Be sure to bring your passport if you’re traveling in from another country. If you’re a resident of a country in the European Union, or another country that is covered by the ESTA Visa waiver “program”, you need to register yourself here before you travel.
- Business Cards – network, share and LinkedIn later.
- Money / credit cards – Mo’ money, mo’ problems? Tips: bring at least two major credit/debit cards (VISA, Eurocard, Amex) and leave one your hotel room’s safe.
- Sun glasses / Hat / Sunscreen. Here in Norway it’s mostly dark at this time of the year, but in LA, the sun is hot – protect yourself from those nasty UV rays.
- Pocket camera / phone: voice/txt/twitter et cetera.
- Computer(s): I’m bringing my Dell Precision M4400 and Latitude E4300. The latter is perfect to bring to the LACC at daytime – the first one is my portable workstation. I have a US power chord to my laptop’s power supplies – it’s always a hassle to bring an extra power converter to the conference center.
- Fiber, fiber, fiber. Well – how should I put it? The American (conference) diet SUCKS. No fiber – and a lot of sugar. I need my fiber, or I’ll turn up constipated and grumpy.
- Omega-3, Ginseng, vitamins: when traveling, remember to super charge on extra vitamins etc. An exhaustive week with jet lag and activities from 6 in the morning to late night does something to your body.
- Sleeping aids; I’ve found some prescription-free sleeping aids that are available in the drug stores (in the US). Be sure to buy some before you leave.
- NoDoz caffeine pills. Generally, I don’t like to pop these – but I bring them for emergency situations.
- A good carry-on laptop bag that you can’t stuff more than a tiny computer in is at least vital to me. I’m not sure if it is to you – YMMV.
Warning: coming up is an ugly formatted HTML table with some pictures to give you a mental note if some of the items you shouldn’t forget at home :-) Mouse-over will give you a description of each item.
A last note before I end this blog post; I love TripIt as a tool to organize my trips – it’s also great for sharing information with people you’re traveling with – or people that may be in the neighborhood during your stay.
November 1st, 2009
So, we’ve reached November 1st – the day after Halloween and it’s only 15 days to the PDC! (Woohoo! :-) )
I’m travelling with two of my colleagues and we’re staying at the Omni from the 14th, send me a message (typically on Twitter: larsw) if you want to hang out before / during the conference.
A couple of days ago (give or take) Microsoft enabled the “My Sessions” feature at www.microsoftpdc.com, and today I’m presenting my first draft of my planned session list. I’m already sure of two things; a) I’ve overbooked, and b) during in the “fog of war” I won’t make it to all of the sessions.
Since I’m a Connected Systems guy, it shouldn’t come as a surprise for anyone that my session list is very CS-centric, but my #2 priority is to attend sessions about features/technology that I really want to learn more about (e.g. where I’m more or less a n00b now :-)
Since the sessions aren’t “mapped out” yet (at least not on the public site) I’ll have to wait a bit before I can do the hard prioritization.
Now, I’m pretty, pretty sure that when I sum up after the PDC, the list of sessions that I’ve actually attended will be quite different :-)
From browsing through the 22 pages of sessions, I’m a bit disappointed that we won’t see Anders Hejlsberg on stage (at least not in a normal session).