Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Contents tagged with .NET 2.0

  • Satellite assemblies and strong names

    I recently had to investigate how to create satellite resource assemblies for assemblies that are strongly named. Some of the information was surprisingly poorly documented, and required some experimentation to figure out, so I'm posting the results in the hope it might save other people some time.

    Here's what I learned:

    • Satellite assemblies for strong named assemblies must be strong named.

      OK, not that surprising.

    • Satellite assemblies for strong named assemblies must be signed with the same key as the main assembly.

      This is actually a bit of a pain for my company, because we use localization partners that in the past have been able to localize the product pretty much independently from us. With our .NET code, we'll have to sign the final satellite assemblies. Fortunately, the localizers can use  delay signing with skip verification to do all of their development and testing, and we just need to do the final signing.

    • By default, satellite assemblies must have the same version number as the main assembly. You can use the SatelliteContractVersionAttribute to enable the main assembly to be versioned while still maintainng compatibility with existing satellite assemblies (thanks to Joe for pointing out this atttribute).

  • Tab control with no visible tabs

    One of my co-workers wanted to use a Windows Forms (2.0, in this case) TabControl as a way of swapping between sets of controls, but without display the actual tabs (controlling the switching entirely through code - a sort of swappable panel stack). After some fiddling around with various control settings, I found that  the following seems to work:

    1. Set SizeMode to Fixed.
    2. Set ItemSize to 0,1. The control won't let you set a size of 0,0, but 0,1 seems to have the desired effect.
    3. Set Appearance to Buttons. This removes the tab control border.
    And that's it. You can work with the tab pages easily in the designer, and use the TabControl properties to set the active tab at runtime.

    Update - One limitation with this approach is that you can't easily change the background color of a tab control. So if you want, for example, a white background on your form, you're out of luck.

  • MSBuild Team releases AssemblyInfoTask

    The MSBuild team has released a great new task, the AssemblyInfoTask. This task makes it easy to automatically update the assembly version numbers (both AssemblyVersion and AssemblyFileVersion, as well as other assembly information attributes) as part of your build process. Neil, on one of the PMs on the team, was nice enough to give me an early look version of the task, and it ROCKS. It's very flexible and easy to use - easily the best solution to the problem that I've found.

    It took me a couple iterations to figure out the best way to incorporate it into our multi-project, multi-solution build, but with some tips from the MSBuild team, I got it working very cleanly and effectively. I'll post some info about how I did it in another blog post when I get a chance.

    Oh, and they've released the source (with unit tests) as well. Very cool.

  • Holy smokes, it finally happened - VS2005 on MSDN Subscriber Downloads

    That's right, VS2005 has been posted for download. That groaning sound you hear is the MS servers being crushed under the load of too many downloads. So far Pro and Standard versions are up, as well as something called "Team Suite Trial Edition". Huh? Also, they've only posted the CD images - I'm hoping for DVD images soon.

    Unfortunately, I'm just getting errors when I try to download it right now.

    Update - It seems that which media you see depends on which server you hit. I went back in again, and the CD version was gone and the DVD version was there. I was able to successfully kick off a DVD download, and it's chugging along. Should be done downloading sometime next month. ;)

  • CruiseControl, MSBuild, and Unit Tests

    While converting our continuous integration process from Nant to MSBuild, I ran into a problem with unit tests. The build script runs our unit tests by calling the nunit-console.exe test runner with the Exec task. The tests reside in a number of assemblies, so I used an ItemGroup to list test assemblies, and batched the call to nunit-console.exe (as described in Peter Provost's blog posting). I wanted to run all of the tests, even if some of them failed, and my first thought was to set the ContinueOnError attribute of the Exec task to true. Unfortunately, there's a problem with this - it turns out that "Continue On Error" really means "Pretend task succeeded". In other words, even with test failures the outcome of the build was "success", and CruiseControl wouldn't report the build as failed. No good.

    The solution to this turns out to be trickier than it probably should be, but it is possible. The idea is to store the exit code of the Exec task into an item group (one item per Exec), then use an Error task to check if any of the Exec's returned errors. Building on Mr Provost's example, the UnitTest target becomes:

    <Target Name="UnitTest" DependsOnTargets="Compile">
     <Exec ContinueOnError='true' Command='$(NUnitEXE) $(NUnitArgs) @(TestAssembly)' WorkingDirectory='%(WorkingDirectory)'>
    <Output TaskParameter="ExitCode" ItemName="ExitCodes"/>
    </Exec>
    <Error Text="Test error occurred" Condition="'%(ExitCodes.Identity)'>0"/>
    </Target>