Preparing Stand-alone SharePoint Farm for Apps Development

Microsoft has made it very easy to setup an development environment on Azure and if you are a MSDN subscription owner it is practically free. To get started with SharePoint development on Azure just follow the instructions published by the SharePoint team last year. Once you have the farm running you still need to complete additional steps to be able to develop and run Apps for SharePoint. Before you can start following the instructions provided by Microsoft some DNS configuration is required.

Assuming you are running with a single server NTML based setup, here is what you need to do:

  1. Use ipconfig /all through the command line to make notes of the machine IP and outside DNS server address
  2. Create a zone for the machine, name it e.g. sharepoint.local . Then make sure there is a host under the sharepoint-local pointing to the machines own IP.
  3. Edit the properties of the (DNS) server itself and add to the list of forwarders one pointing to the outside DNS server
  4. Create a zone for your apps, name it e.g. apps.com (primary zone)
  5. Add a cname under the apps.com with the fqdn *.apps.com and “full target name for target host” being e.g. <machine name>.sharepoint.local
  6. Finally check everything is working by running ipconfig /flushdns followed by trying to access your local SharePoint and the internet. Try also pinging e.g. whatever.apps.com

DNS settings

Advertisements

Server Error in ‘/tfs’ Application

Setting up Team Foundation Server 2010 RC was easy, especially when selecting the Basic profile as it does not require you to setup SharePoint and the SQL Server Reporting Services. Everything on the Visual Studio and source control side worked well.

But when I fired up my browser the have a look at the Web Access now a partof the standards TFS, IIS prompted me with the following error:


I was not sure if the Basic profile included the Web Access as I could not find any info on it on the web.  The IIS diagnostic tools suggested the server had problems accessing the folder so I tried all sorts of things with the security settings. By googling I found some solutions for older IIS versions, but I didn’t want to do anything that would e.g. prevent me from updating my TFS setup later.

Finally I added a bug report to Microsoft Connect and as the solution they suggested was the same I had found earlier, so I tried it.

For some reason the installation of the web access web application had gone wrong. All I needed to do to fix the problem was to convert the web folder into an application:

Seconds later I could access projects using the browser!

Unfortunately my problems with the Web Access did not end there. At the moment I’m unable to create child work items using the web access interface:

Again, I’ve made a bug report on it. I will edit this post when I find a solution. If you are having any of these problems, give my bug reports your vote!

Windows 7 Activation: Error 0xC004F074

Windows 7 activation failure

Installing Windows 7 was over in a few minutes, but I had some problems with the activation. After some googling I found the answer in one of the comments to a post in Mikael Sands blog.

If you get an error 0xC004F074 when trying to activate a enterprise edition Windows 7, check that your date and time settings are correct! For some reason my date setting was wrong and correcting it enabled Windows 7 to communicate with the KMS.

Quick Guide to Installing Windows XP Mode

Microsoft provides an virtual Windows XP environment for Windows 7 called Windows XP Mode to help with migrating old applications to work on the new operating system.

By completing these steps you’ll have Windows XP Mode up and running in a few seconds:

  1. First you need to make sure your CPU has the required support for virtualization. The easiest way to do this is by running a small application called SecurAble. You might need to enable the virtualization support from your BIOS.  After swtiching it on you might need to completely shut down your computer as a simple reboot might just not do it.
  2. Get the latest files for Windows XP Mode and Virtual PC from Microsoft and install them
  3. Select Windows XP Mode from you start menu under Windows Virtual PC and enter some logon credentials for the virtual environment

You’re done!

Note that while in Windows XP Mode you might run into the following error if you try to start some setup located on a external USB or network drive:

“The Windows Installer does not permit installation from a Remote Desktop Connection”

This is because Windows XP Mode sees you as a remote desktop user and for some security reason the Windows Installer can’t permit you to execute a “remote” setup. To solve this problem, first copy all the setup files into the virtual environment and then run the setup!

Supporting Documentation Using Task Tokens

Many details get left to be documented first after the programming have been finished. At that stage there are million an one things to document and many important but small details get easily forgotten.

I’ve been trying to figure out how to integrate the documentation as a part of the programming. In one of my projects I decided to try using Task list tokens to help me write about important details the minute it comes to my mind that it need to be documented. This worked well, so I decided to share this with you.

You can add tokens through the Visual Studio Options, I called my new token DOCUMENT.

Task List Options

You can use your cusotm tokens the same way you use the in-built ones like TODO.


public string GetPath()
{
// DOCUMENT: Path generated using magic
return DoMagic();
}

When it’s time to document you can easily copy-paste (first remove extra columns if necessary) your DOCUMENT tasks to Word.

Document Tasks

Combining Enums and Attributes

Enums are a porwerful and simple way to define standard and expected values. Enums can be easily linked with the database by storing the values as numbers or with XML data by storing the value names as text. The values can be easily converted and parsed both ways using the functions of the Enum class.

Linking enum values with the user interface is more tricky. Longer enum names are not very user friendly so you don’t want to display them directly. Combining attributes with your enums offers a flexible way to control how your enums are presented to the user.

First you need a custom attribute to decorate the values definitions with:

[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = false)]
public class EnumDescriptionAttribute : Attribute
{
   public EnumDescriptionAttribute(string description)
   {
      Description = description;
   }

   public string Description { get; set; }
}

Then use your attribute to decorate your enums like this:

public enum PowerConsumtion { 
   [
EnumDescriptionAttribute(“Full power”)]
   High,
   [EnumDescriptionAttribute(“Energy saver”)]
   Low
}

Then all you need is a function extending the features of the Enum.GetNames() to return the user friendly names:

public static string[] GetNames(Type enumType, string group)
{
   List<string> names = new List<string>();
   Type type = enumType;

   FieldInfo[] fields = type.GetFields();

   for (int i = 1; i < fields.Length; i++)
   {
      FieldInfo field = fields[i];
      EnumDescriptionAttribute attribute = GetDescription(field);

      string descrption = field.Name;

      if (attribute != null)
      {
         if (attribute.Description != null)
            descrption = attribute.Description;
      }

      names.Add(descrption);
   }

   return names.ToArray();
}

private static EnumDescriptionAttribute GetDescription(FieldInfo field)
{
   EnumDescriptionAttribute[] attributes = field.GetCustomAttributes(typeof(EnumDescriptionAttribute), false) as EnumDescriptionAttribute
[];    
  
   if (attributes != null && attributes.Length > 0)
   {
      return attributes[0];
   }
   else
   {
      return null;
   }
}

 

You can now use the attributes to help you decorate the values with any kind of information. I usually have properties for hiding and groupping values.