I have been taking for granted about line ending till I stumble upon a manifest mismatch on VSTO project. I used to think that storing in Unix-style in the remote Git repo, but working on Windows-style is the way to go. That way, I was allowing collaborators to choose their own style. But hey, VSTO only lives in Windows. Who cares about this generic rule of thumb!

*enough rambling*

I cloned a installer project for VSTO from a Git repo. All went well, but I got this error when trying to test the VSTO project on my Microsoft Word.

System.Deployment.Application.InvalidDeploymentException: Application manidest has either a different computed hash than the one specified or no has specified at all.

wordaddin

The above error tells that the manifest file does not match because of different computed hash. In a plain English, the manifest file might have been changed. And, the Git handling on line ending is the culprit.

git config core.autocrlf

The rule of thumb is to set it to ‘true’ for Windows and ‘input’ for Mac or Linux. Below is the

  1. ‘true’ => Checkout Windows-style, commit Unix-style
  2. ‘input’ => Checkout as-is, commit Unix-style
  3. ‘false’ => Checkout as-is, commit as-is

Having set the value to true would make the manifest file being modified while committing this file. Hence, we can specify this autocrlf in this particular project to false. Don’t try to change the value globally to false.

However, this solution is not quite elegant. Fortunately, Git offers more flexibility on dealing with this issue: adding .gitattributes file.

*.dll.manifest -text

This -text means that the files will not get normalized.

Further readings: https://help.github.com/articles/dealing-with-line-endings/#platform-windows

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s