Friday, 16 January 2015

Building TRViewer – part 2

To build the release version of TRViewer, change the active configuration in the toolbar to Release and click BUILD>Build Solution.

Change active configuration to Release

The build fails with one error.

1 error

The option /MAPINFO:LINES was dropped in Visual Studio 2005 and is no longer valid.
We will remove this option in the property pages.

In TRViewer’s Property Pages for the Release configuration, go to the Configuration Properties> Linker>Command Line setting.
Delete “/MAPINFO:LINES” from the Additional Options box and click Apply to save the change.

Delete the MAPINFO LINES option

Before closing the property pages, modify the output directory option like we did for the Debug configuration. We need to do this so we can run the release version of TRViewer from Visual Studio.

In TRViewer’s Property Pages for the Release configuration, change Configuration Properties>General>Output Directory to “..\bin\Release” and click OK to save the change.

Change Output Directory setting
TRViewer builds successfully.

Release version builds successfully

To run TRVIewer click DEBUG>Start Without Debugging. There is no point running from the debugger since the release version doesn’t contain any debugging information in its code.

Unlike the Debug version the release version opens TR files from the Open menu item and toolbar button.

Office.tr4 open in TRViewer

I don’t know why the Debug version crashes when using the Open menu item or toolbar button and will look into it in a future post.

Now that we have both configurations built we will add the project to a source control management (SCM) system.

In essence this means you periodically make a backup of your files (commit), can review the changes between backups and restore the project to an earlier state if necessary.

The SCM we will use is called git but Visual Studio also offers another system.

I already had git installed on my PC so I guess you will need to install it to use it with Visual Studio. [link]

Visual Studio may get you to choose between git and Team Explorer at some stage.

For projects not already under SCM there will be an option to Add to Source Control in the FILE menu.

Implement source control management

I get this warning but I am unsure which projects lie outside the solution folder and just click OK anyway.

Git warning

When the project is first added to git, a storage area known as a repository (.git folder) is created in the solution’s folder to keep track of your files but no files are backed up yet.

To save an initial copy of your files you have to commit them.

Right click on the project name in the Solution Explorer window and click Source Control>Commit.

Commit menu item

The Team Explorer window shows all the changed files that will be backed up in this commit in the Included Changes section.

You mainly backup text files and not binary files but can add binary files if you wish. For text files only the changes from the previous version are stored but for binary files the whole file is stored.

If any files appear in the Excluded Changes section that you wish to be committed you can right click on them and choose Include or drag and drop them onto the Included Changes section.

At this stage there aren’t any files in the Untracked Files section but if new files are created or added to the project after the first commit they will appear in this section.

Commit window

To commit the changes, type a short descriptive message in the box as indicated and click the Commit button which will become enabled after you enter a message.

First Commit

Every time you make changes to your code you wish to backup you will follow this same process to commit them however you will most likely have fewer changed files to commit than you did for the first commit because the first commit has to save all the files.


prev | next

No comments:

Post a Comment