Sunday, October 20, 2013

Placing a Code On Time App under Source Control

Suppose that we have an application called “Northwind” that we need to place under source control with Microsoft Team Foundation Service (TFS).

Web apps created with Code On Time are contained in a single folder and organized by project type under My Documents\Code OnTime\Projects.

Location of the Northwind project.

The folder that needs to be synchronized is located at ~\My Documents\Code OnTime\Projects\Mobile Factory\Northwind in the picture above.

TFS organizes projects and assorted files into groups called “team projects”, which are themselves organized into collections. We will need to connect the ~\My Documents\Code OnTime\Projects\Mobile Factory\Northwind folder to a specific folder inside of a team project. The picture below shows the server folder organization in Source Control Explorer of Visual Studio after the project is added to TFS.

Note that Mobile Factory and Web Site Factory apps are contained under a master folder with the same name as the application project. The master folder also stores the Visual Studio solution file for the project. This is how TFS organizes projects of these types.

Folder layout in the TFS server.

Every other project type does not have a master folder. The Visual Studio solution file is stored directly in the project folder.

The Visual Studio solution file is stored directly in the project folder.

Let’s create a project and add it to the Team Foundation Service.

You will need to open a new TFS account if you do not already have one.

Connecting a Project to Team Foundation Server

Create a new web application. When complete, open the project in Visual Studio. Open the Team Explorer toolbar, typically available in the same window as the Solution Explorer. Click on the Connect icon on the toolbar to connect to team projects.

Connecting to a team project in Visual Studio.

Select the “Connect” link to activate the Connect to Team Foundation Server window. Click on the “Servers…” button.

Adding a TFS server.

Press “Add…”, and enter the URL of your server in the textbox.

Specifying the URL of a team foundation server to add to Visual Studio.

Press OK to save the server. You may need to log in to access the server. If there are no errors, press Close to close the Servers window, select the team project in the Team Projects list, and press Connect.

Adding the Solution to Source Control

Switch back to the Solution Explorer tab. Right-click on the solution, and press Add Solution to Source Control.

Adding a solution to source control.

Select the Team Project in Add Solution to Source Control window. Create a new folder to organize your projects and specify a name for the solution folder that the web app will be saved in. Press OK to add the solution.

Specifying the location on the team foundation server that the project will be saved to.

To perform the initial check-in, right-click on the solution in the Solution Explorer and press “Check In…”.

Checking in the project.

The Team Explorer window will be activated. Enter an optional comment.

Entering an optional revision comment.

Visual Studio will decide on its own which files will be under source control. There are several files that need to be excluded or included under source control. This will depend on the project type.

Application generator maintains several XML files that describe the application design. Some of the files are not necessary for the application to run and do not need to be placed under source control.

Excluding Files in Mobile Factory or Web Site Factory

Visual Studio will decide to include all project files in a Mobile Factory or Web Site Factory project.

Click on “Go to All Changes”, hold Ctrl, and select the following files in the list:

Application.Log.xml (if present)
Controllers.Log.xml (if present)

Right-click, and press Exclude.

Excluding the project files from source control.

Excluding Files in Web App Factory, Azure Factory, DNN Factory, and SharePoint Factory

Web App Factory, Azure Factory, DNN Factory, and SharePoint Factory require the inclusion of essential project files.

Under the Excluded Changes section, click on “Detected:…”.

Clicking on "Detected..." to include several files that are excluded by default.

Select only the following items: “ClientLibrary.*.txt”, “DataAquarium.Project.xml”, and “DataAquarium.Version.xml”.

Including the correct files so that the app generator can still handle the project.

Press Promote to add the files to the pending changes.

Committing the Revision

Press the Back icon on the Team Explorer toolbar, and then press Check In.

Checking in the project.

The project code is now under control of Team Foundation Server.

Activating Project Synchronization

Start the web app generator. Click on the project, and select Sync.

Selecting Sync option in the Project Actions page.

Enter your user name and password in the relevant fields. If you have not yet created an account, enter your purchase email and activation code.

Entering username and password in order to configure synchronization.

Press Save, and the web application generator will proceed to upload your project.

Note that your account must be marked as an Account Owner or Project Manager in Code On Time Account Manager in order to add a new project.

Now, the other team members can get the latest version of the project from Team Foundation Service and establish synchronization of Project Designer change logs.

Adding New Project Members

In order for other team members to work on the same project, they must be added to the Team Project in TFS and the synchronization service account.

First, navigate to and proceed to log in.


Navigate to the Users page. On the action bar, select New User.

Adding a new user to the account.

Enter the user details. Make sure to mark the user as enabled. Also select the checkbox next to the project name.

Specifying details for the new user account.

Press OK to save the new user account. Select Activation Code | Email action on the action bar to send the personal activation code to the user.

Emailing the personal activation code to the new user.

Note that personal activation code is different from the Code On Time product activation code. The personal activation code will allow developers to activate the app generator and synchronize Project Designer changes.

Next, navigate to URL of your team foundation service. In the top-right corner of the page, click on the Gear icon.

Selecting the Gear icon in TFS website to access settings.

Navigate to the Team of the project, and click on “View the team administration page”.

Accessing the team administration page.

In the list of Team members, press Add… | New User.

Adding a user to the project.

Type in the Windows Live ID of the new user, and press Save Changes.

Adding a user to the project.

The user will now have access to the project stored in Team Foundation Service.

Getting Code on the Project Member Computer

The team member must start Visual Studio and log into the TFS server using the their own credentials. The following steps will need to be performed.

In the menu, press File | Source Control | Advanced | Workspaces….

Managing workspaces from Visual Studio.

Press Add… in the bottom left corner.

If the project type is Mobile Factory or Web Site Factory, two mappings are needed. The first mapping will correctly place the solution file in the ~\Code OnTime\Solutions folder. The second mapping will place the code under the ~\Code OnTime\Projects folder.

Adding two working folders. One is for solution and the other is for the project.

If the project type is Web App Factory, Azure Factory, DotNetNuke Factory, or SharePoint Factory, only one folder needs to be mapped to ~\CodeOnTime\Projects\PROJECT_TYPE\PROJECT_NAME.

Source control mapping for Web App and Azure Factory projects.

Press OK to save the mappings.

When Visual Studio prompts to download the source code files, confirm and wait for the download to finish.

Visual Studio downloading the source code.

Once the download is complete, switch back to the app generator and refresh the start page by pressing F5. Click on the newly added project and press Sync. Add your credentials and press Save.

Saving synchronization settings for the project.

The generator will proceed to download the latest version of the web application revisions and refresh the project.

Press Design to activate the Project Designer or Generate to view the application in a browser.

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.

© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at