Archive → Author
Using VS.NET web application projects with both VS.NET 2008 and 2010 RTM
What a palaver. Prior to RTM you could use VS.NET 2008 and 2010 web application projects alongside each other with no issues (after having 2010 upgrade them). With RTM, you get horrible issues with the line:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\
v10.0\WebApplications\Microsoft.WebApplication.targets" />
Added to the bottom of your .csproj files. After much soul searching I’ve found a solution with a bit of MSBuild cleverness. Turns out you can conditioanlly include MSBuild targets depending on the version of Visual Studio being used.
So, for each web application project in your solution:
- a) Have VS.NET 2010 upgrade your projects to the newer version.
- b) Replace the above line with:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\ v9.0\WebApplications\Microsoft.WebApplication.targets"
Condition="'$(Solutions.VSVersion)' == '9.0'" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\ v10.0\WebApplications\Microsoft.WebApplication.targets"
Condition="'$(Solutions.VSVersion)' == '10.0'" />
- c) Blank out <FileUpgradeFlags></FileUpgradeFlags> which VS.NET 2010 has probably put “4.0” in, this will trip 2008 up otherwise.
- d) Blank out <UpgradeBackupLocation></UpgradeBackupLocation> in the same manner.
As long as you can then live with working with a seperate solution file for VS.NET 2010, you should be away and can stop annoying anyone else working on your files!
.NET Settings Providers
I’m researching different methods of persisting, updating and managing configuration in .NET, as I’ve become a bit tired of rolling my own static “Config” class.
Having used the newer Settings architecture (as opposed to the old fashioned non-typed AppSettings) on a small scale site, I’ve been interested in how it might be possible to extend these over a distributed system.
Turns out you can, the system is pluggable.
http://msdn.microsoft.com/en-us/library/8eyb2ct1.aspx
http://www.sellsbrothers.com/writing/default.aspx?content=dotnet2customsettingsprovider.htm
Over the next few weeks I’ll be exploring how this might benefit an application – especially in the area of not having to restart when writing to app.config files!
Sending E-Mails (the longer than usual story)
http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html
Very interesting article (fewer and farther between unfortunately these days) from Jeff Atwood about some of their experiences with building Stack Overflow and sending out mails and having them actually arrive! Quite pertinent as I’m currently working in a similar area.
Essentially, firstly send mail from your client to: check-auth@verifier.port25.com and get a free report on basically what you’re missing from your setup. You can do this over and over again to get a picture for how you’re progressing.
Obviously the article goes into detail, but in summary:
1. Make sure the computer sending the email has a Reverse PTR record
2. Configure DomainKeys Identified Mail in your DNS and code
3. Set up a SenderID record in your DNS
Basically they are all a combination of adding the correct TXT and PTR records to your domain names, as well as generating a public/private key pair, signing your mails with the private one and making the public part available via DNS.
They use a commercial piece of software called Mailbee.NET to do the signing work, but this is possible using good old SmtpClient with something like this: http://tinisles.blogspot.com/2009/09/sending-dkim-email-from-c.html.
Not production code by any stretch of the imagination, and some of the work he does to build a CN and do the actual signing could be done using the built-in BCL classes but you get the picture. I’ll post again when I have this working.
ASP.NET MVC vs. Ruby on Rails
http://anders.janmyr.com/2010/04/aspnet-mvc-vs-rails3.html
Quite an interesting article on this, if extremely biased towards RoR.
A few salient points:
- RoR is entirely command line based, ASP MVC is obviously more tied to Visual Studio (although I would debate that as you could do everything by command line, ms build and notepad)
- Very similar in all basic respects.
- No analysis of more important and “edgy” factors such as model binding (ASP MVC is very good at this) and validation frameworks.
- I’m still jealous in some respects of RoR DB migrations – I wonder if there is a .NET based port of this going anywhere? I should lend a hand if so.
- Routing is a tie, both good.
- Pretty much parity beyond that (at least as far as the article is concerned).
iTunes 9 Live Playlists and “limit” options
More for my own reference really, but this might be useful to others – certainly been driving me mad enough over the last few weeks!
I’ve got an iTouch 64Gb and have previously been synching it with iTunes 8.x without issue, but on upgrade to 9, all of my “most played”, “most recently added” etc playlists suddenly show random tracks (on the handset only).
This is down to the issues described at: http://discussions.info.apple.com/thread.jspa?threadID=2227108&tstart=1.
Basically, to cut a long story short, you need to add this option to each playlist with a “limit” set:
Re-sync and voila, life is sane again. That said the performance and literary of niggly bugs with iTunes (as well as the heavy handed updater) is getting on my nerves. Roll on Windows Mobile 7!
Mercurial Tutorial
The best thing (Stackoverflow related aside) that Joel Spolsky has written in a long time, a really accessible tutorial to Mercurial (espeically for Subversion users).
EDIT: This is the essence of the workflow.
MiniDumpWriteDump
http://www.codeproject.com/KB/debug/postmortemdebug_standalone1.aspx
I’m trying to come up with a standard and reliable way to trigger a core dump from within the logging/exception handling of a C# executable. The above article indicates that this should be possible, but it sounds as if making this work across platforms would be a fairly large nightmare.
If anyone has done anything similar to this, I’d be interested to see how you went about it, and if possible maybe we could share/release some code to make this easier.
Genius at Work
Here’s a Channel 9 interview with Anders Hejlsberg, the creator and head designer of C# as a language (as well as Delphi back in the day).
Interesting in that it examines some of the improvements in C# 4.0, as well as features that are being bandied around for even further out.
Also contains the best description of contra-variance and co-variance that I’ve seen so far.
http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Anders-Hejlsberg-The-Future-of-C/
Database Versioning Strategies
http://flux88.com/blog/net-database-migration-tool-roundup/
Microblog to bring attention to this for myself in the future.
Strategies on how to maintain scripts for database versioning, and how upgrades and downgrades can be managed in a much more automated and reliable fashion than manual scripting.
EC2 for Windows now in Europe
Quick post to say ‘thanks’! This has suddenly got a whole lot more viable for use as testing/staging boxes outside of the US!
http://www.allthingsdistributed.com/2009/03/expanding_ec2_for_windows.html
Recent Comments