Posts tagged with .NET

  • Playing with TeamCity on Azure

    Mar 10, 2018

    I spent the past two days playing with setting up TeamCity on Azure. This is just a poc more than anything else, but it’s always fun to do something new. I had to fiddle about with some things that didn’t work as expected, so here are some notes to remember what I did.

  • How to use StyleCop.Analyzers

    Mar 3, 2018

    I played a bit with StyleCop.Analyzers the other day and I wanted to share what I did. I’ll be showing how to add a stylecop file, how to use the same rules across projects, how to create a custom ruleset file.

  • TDD with .NET Core and Visual Studio Code

    Jun 5, 2017

    In this post we’ll see how to create a .NET Core solution with two projects with using nothing but the command line. Once that is setup, we’ll do a bit of TDD using Visual Studio Code.

  • Code coverage for open source .NET with AppVeyor and Coveralls

    Mar 19, 2016

    Code coverage is a useful metric of the quality of your code. It shows how much code is being covered by unit tests. It doesn’t necessarily mean that the unit tests are well written, but no metric can probably tell you that. However, aiming for a specific code coverage, let’s say 70%, is a good practice, because failing to meet the goal might mean somebody didn’t write enough unit tests.

  • Troubleshooting TypeLoadException in mono

    Mar 12, 2016

    I don’t do a lot of .NET programming these days. At work we deal mostly with JavaScript. However, C# is still the language I’m more fluent in and, also important, a language that I really like. That’s why sometimes I like to code a bit in C# at home. That can be either on Windows or on a Mac with Mono. The problem with Mono is that things can always be a bit different and require some extra effort.

  • View .NET assembly version on Ubuntu

    Aug 3, 2014

    When you want to view the assembly version of a .NET assembly in Windows, you just right click the DLL and view its properties. Or, you just hover the mouse over the file and the version number will be shown in the tooltip. In Linux, things aren’t as easy.

  • Compiling Mono and friends on Ubuntu, v2

    Jul 19, 2014

    This is an updated guide on how to compile mono from source on Ubuntu. This time, it’s about Ubuntu 14.04 (trusty tahr). This post covers:

  • log4net SmtpAppender on mono

    Feb 15, 2014

    I have some problems with the SmtpAppender of log4net on mono. I couldn’t figure out what was going wrong, it just wasn’t sending any e-mails.

  • Using controllers with the same name in ASP.NET MVC

    Dec 17, 2013

    How to use controllers that have the same class name but different namespaces in ASP.NET MVC.

  • MSBuild Community Tasks NUnit and Mono

    Nov 20, 2013

    As an experiment, I modified an NUnit test project to automatically test itself after the build process. This way, the unit tests become an integral part of the build; just by building in Visual Studio you’ll know if you’ve broken a unit test.

  • Compiling Mono and XSP on Ubuntu

    Oct 19, 2013

    For future reference, this is what you need to do in order to install Mono and XSP on Ubuntu Server 12.04.3 LTS x64. This is about a completely blank installation, where only the SSH server role was selected during the installation of the OS.

  • BlogEngine.NET MVC - Progress update

    Mar 13, 2013

    Here’s a short update on what I’ve been working on. Time is a bit limited but I like to hack around in this project and that’s what it’s all about!

  • BlogEngine.NET MVC - Posts and Pages

    Mar 9, 2013

    In the latest commit on BlogEngine.NET MVC, which is always available here, the following have been added:

  • BlogEngine.NET MVC - Login time

    Mar 7, 2013

    It’s not difficult to implement a basic login system. BlogEngine.NET comes with its own membership and roles providers, so all we need to do is create a controller that uses the standard Membership features of .NET.

  • BlogEngine.NET MVC - Hello world

    Mar 6, 2013

    So, to share a bit more of my excitement, here’s a screenshot of the classic ASP.NET and the MVC versions running side by side:

  • BlogEngine.NET MVC

    Mar 6, 2013

    Finally, I got to play with ASP.NET MVC for a real project at work. I really enjoyed it, but it lasted only for a few weeks.

  • w3c-nant version 1.2.0 released

    Feb 16, 2013

    Version 1.2.0 of w3c-nant was released today. This version contains some improvements submitted by Rob Richardson:

  • Run dotCover from msbuild and ccnet

    Sep 2, 2012

    TeamCity is a very nice tool that I use at home. Unfortunately the free license allows up to 20 configurations. That’s why I’m experimenting also with another free tool, CruiseControl. It’s definitely not as easy as TeamCity, you have to edit (which means learn) an XML file that the server picks up. In general, it probably supports what TeamCity supports, but you have to make everything yourself with a lot of work. Then again, it’s completely free.

  • Synchronizing App_Data with git

    Aug 26, 2012

    When you have a web application that stores data in it’s App_Data folder, at some point you’ll want to synchronize the development environment(s) with the live environment. This way your development machine will have the latest live data. This is a task that can be achieved with git.

  • Mac and Mono

    Aug 25, 2012

    Some random steps on getting my Mac up to speed with Mono development.

  • w3c-nant version 1.1.1 released

    Jun 23, 2012

    Short after releasing version 1.1.0, a new bug-fix version is been released.

  • w3c-nant version 1.1.0 released

    Jun 17, 2012

    A new version for w3c-nant was released today. What is new in this version:

  • Extending NUnit: NUnit Companion

    Mar 25, 2012

    I have several test fixtures (test classes) written in NUnit that verify my data layer works against a live database (MSSQL). By live I mean that there is no mocking or anything like that - that’s for the higher layers where I mock the data layer.

  • Announcing w3c-nant version 1.0.2 - now with FTP upload task!

    Mar 4, 2012

    I added a new NAnt task in the w3c-nant library to allow FTP uploads. Using the same fileset mechanism as the copy task, you can create powerful scripts to automate deploying in a remote FTP server. Or at least that’s what I’m using it for!

  • Continuous Deployment with a Windows Service project

    Oct 25, 2011

    For a long time now I had a long running process here at home implemented as a Windows Console application. The application was quite stable, but from time to time I had to fix a bug or add a new feature. Before deploying a new version, I would have to login to the deployment machine where the application was running and terminate it, otherwise deployment would fail trying to copy over the new files. Quite tedious. And then I would have to start it again, as soon as the deployment server had finished its job. I like to automate this kind of things.

  • WCF and deferred execution - where is my Exception?

    Oct 23, 2011

    A long time ago, I blogged about WCF and deferred LINQ queries and some surprises that combination may have. Back then, our WCF service would crash inexplicably when the returning type of an operation would contain an enumerable whose evaluation was deferred until after the WCF operation was out of scope.

  • Overriding EPiServer pages

    Jul 21, 2011

    It is not very frequent or pretty but still sometimes it’s inevitable: we have to “steal” the code of EPiServer through Reflector/ILSpy/other and modify it to suit our needs. This way you can customize pages or user controls anyway you wish, beyond the way EPiServer allows through conventional channels.

  • WCF, JSON and the DateTime

    Jul 20, 2011

    I’m playing with a WCF service that works with JSON. If you haven’t done this already, it’s fairly easy. In the web.config, make sure your service is using the webHttpBinding binding. Also you’ll need an endpoint behavior that looks like this:

  • MasterType directive and namespace conflicts

    Jul 12, 2011

    Let me start by saying that I hope you won’t run into this one and that you probably won’t.

  • IIS 7 gives 404.17 error with svc WCF services

    Jul 2, 2011

    If you try to access a svc service hosted in IIS and you get the following error:

  • Exceptions using type initializer based singletons

    Jun 9, 2011

    A popular web page describing how to implement a singleton in C# is this one, where several ways to implement a singleton are discussed. I usually pick the last option, which, according to the author of that page, has the most benefits. The author goes on to mention some problems that can occur if an exception is thrown in the constructor, but I never paid attention to that until recently.

  • How to use SQLite with Mono and Fluent NHibernate

    Jun 6, 2011

    So I have setup my project playing nice in Windows .NET 4.0 with SQLite and Fluent NHibernate. I opened it up from my Mac to see if it would still work and, big surprise, it didn’t. It complained about System.Data.SQLite.dll not found, even though the dll was there.

  • Thread-safe code

    Jun 5, 2011

    Consider this code:

  • Custom progress indicator for UpdatePanel

    Apr 10, 2011

    In ASP.NET the UpdatePanel can help you create an AJAX experience very fast and easy. It is typical to provide some visual element in the page that indicates that the AJAX request is been processed. This can be an animated image, a simple text message, a pretty modal box with a nice shadow effect - anything that does the trick and tells the user that the page is not broken but it’s busy.

  • SystemWebCompanion

    Mar 19, 2011

    In many ASP.NET web applications, there are some small bits of code that you have to write over and over again. They’re too small so you never bother to refactor them out as a reusable dll. After all they are so small that it’s very fast to create from scratch again. They end up as a Utils.cs file somewhere in your project, probably repeated in all your projects in one form or another.

  • Valid HTML and Valid CSS

    Mar 12, 2011

    This blog (and this site in general) has two nice image buttons at the end of the page, saying that the HTML and CSS are valid. Are they really?

  • ASP.NET IsMobileDevice and how it works

    Mar 12, 2011

    In ASP.NET, you can use the IsMobileDevice property in the Request.Browser object of the current request to figure out if the user is calling your application using a mobile device.

  • WCF with IIS and multiple http bindings

    Mar 4, 2011

    If you’re writing a WCF service using .NET 3.5 and the service is hosted in IIS, there is a situation where you will get this strange error message:

  • Getting the client's timezone in ASP.NET

    Dec 1, 2010

    The client (browser) doesn’t send any information to the server regarding the client’s timezone. It’s just not supported. One might try to guess the timezone from the culture or even try to guess it from this new geo-location feature. Maybe in the future there will be a new header like “X-Client-Timezone: UTC+1” but for the time being a good approach is the following.

  • Playing with MonoMac

    Nov 7, 2010

    Yesterday I played a bit with MonoMac, a new framework for Mono that you can use in order to create .NET applications that have a native look and feel in Mac OS X. I have never done any Mac related development in the past so I had to read up on how Apple builts its UIs. My experiments made their way to ResxTranslator’s code base, so I intend that ResxTranslator will have three separate UIs: WinForms, GTK# and now Cocoa via MonoMac!

  • ResxTranslator: a resx file editor

    Oct 31, 2010

    ResxTranslator is an open source project that facilitates easy translation of resx files. Resx files are XML files that .NET uses to store localizable strings. Visual Studio offers a built-in designer but MonoDevelop currently doesn’t offer support for resx files. In addition to that, ResxTranslator is able to open multiple files in the same window, so that a user can translate strings while looking at the original text at the same time. Oh, and it is at this moment developed only by me when I have some time to spare :-)

  • Deferred LINQ queries in WCF services

    Sep 12, 2010

    Consider the following WCF service:

  • First Umbraco experience

    Aug 15, 2010

    Today I played a bit with Umbraco for the first time. I mostly focused on its multilingual support, which is a feature I usually expect from a CMS.

  • Playing with Castle DynamicProxy

    Jul 24, 2010

    If you’ve ever used an ORM tool, such as NHibernate or the Entity Framework, you’ll probably have noticed that their goal is to be as unobtrusive as possible. They say, and I agree, that you shouldn’t be forced to have your business objects inherit from strange classes like MarshalByRefObject, or to annotate your properties with all sorts of ORM specific attributes. In that aspect, I find NHibernate to be rather clean.

  • Dynamic PNG Image Generation with ASP.NET

    Jun 25, 2010

    I had created a small web app in MonoDevelop that created a png image on the fly. Porting the app to Windows .NET 3.5 with Visual Studio 2008 was almost painless, but it did include two unexpected incident. The first one was… well the app didn’t run anymore, showing the dreadful “A generic error occured in GDI+”. A bit of a research lead to this article here. Apparently the problem occurs only with PNG images. The stream that you write the generated image to needs to be seekable and I guess in Mono the Response.OutputStream is seekable but in .NET it’s not. The solution is to use an intermediate MemoryStream to write the image to and then dump that stream on Response.OutputStream.