Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Can't build CodeContracts - installer building fails #375

Open
Dennis-Petrov opened this issue Feb 9, 2016 · 19 comments
Open

Can't build CodeContracts - installer building fails #375

Dennis-Petrov opened this issue Feb 9, 2016 · 19 comments

Comments

@Dennis-Petrov
Copy link

Hi everyone.
I've forked CC from master branch yesterday, and can't build it via batch file. I'm running buildcc.bat from MSBuild command prompt (VS2015) and getting this error:

Build FAILED.

"D:\Projects\Research\CodeContracts\Microsoft.Research\ManagedContract.Setup\bu
ildMSI10.xml" (All target) (1) ->
(CreateVersionFile target) ->
EXEC : error : unknown switch '?' [D:\Projects\Research\CodeContracts\Microso
ft.Research\ManagedContract.Setup\buildMSI10.xml]
D:\Projects\Research\CodeContracts\Microsoft.Research\ManagedContract.Setup\b
uildMSI10.xml(299,5): error MSB3073: The command "git update-index --assume-unc
hanged ..\common\include\version.cs" exited with code 129.

0 Warning(s)
2 Error(s)

My machine has git 2.7.0.2 x64 installed - I had to install it, because for now it is impossible to build without git at all.

Maybe, README.MD misses some details about building process?

@SergeyTeplyakov
Copy link
Contributor

You need to use VS2013. VS2015 is still not supported (the error message looks weird, but even if this one will pass you'll face another issue with VS2015)..

@hubuk
Copy link
Contributor

hubuk commented Feb 9, 2016

I was able to reproduce the issue. The error message is indeed weird:

  git update-index --assume-unchanged ..\common\include\version.cs
EXEC : error : unknown switch '?' [D:\Github\Microsoft\CodeContracts\Microsoft.Research
\ManagedContract.Setup\buildMSI10.xml]
  usage: git update-index [<options>] [--] [<file>...]

      (...)
      --assume-unchanged    mark files as "not changing"
      (...)

When running on dev cmd for VS2013 with the same version of git (2.7.0.2 x64) everything works fine.

@Dennis-Petrov
Copy link
Author

@SergeyTeplyakov: well... I've built CC about 3 weeks ago successfully from master branch using VS 2015. Moreover, I was able to build it from unpacked ZIP-archive, without git installed, while now I had to clone git repository locally.

Definitely something was changed in build scripts (maybe, somewhere else, this is just an assumption). Also note, that CC libraries are built just fine. The case is in installer. Are you sure, that the problem is in VS (MSBuild version)?

@yaakov-h
Copy link
Contributor

yaakov-h commented Feb 9, 2016

VS2013 Developer Command Prompt plus Git in my path (I think latest Git for Windows) works fine for me, but I am also building from a cloned repository.

Could it be that git update-index fails in odd ways if it's not running from a git repo?

@SergeyTeplyakov
Copy link
Contributor

@Dennis-Petrov Now, it is clear that something is broken.

@SergeyTeplyakov
Copy link
Contributor

But the question is, why the failure is happening on the git command? I'll try to check it tomorrow (almost 1 a.m. in the morning right now in my time zone).

@Dennis-Petrov
Copy link
Author

@SergeyTeplyakov: I've figured out it. :) There's a typo here (buildMSI10.xml):

<Exec Command="git update-index -–assume-unchanged @(VersionFile)"/>

The second dash before "assume" has 0x2013 code instead of 0x2D ("minus" key on keyboard). Looks like there several such typos there. These ones too:

<Exec Command="git update-index -–assume-unchanged ..\ContractAdornments\Extension\source.extension.vsixmanifest"/>
<Exec Command="git update-index -–assume-unchanged VSIX\VS10.extension.vsixmanifest"/>
<Exec Command="git update-index -–assume-unchanged VSIX\VS11.extension.vsixmanifest"/>
<Exec Command="git update-index -–assume-unchanged VSIX\VS12.extension.vsixmanifest"/>
<Exec Command="git update-index -–assume-unchanged VSIX\VS14.extension.vsixmanifest"/>

@hubuk
Copy link
Contributor

hubuk commented Feb 9, 2016

My fault. PR created.

@yaakov-h
Copy link
Contributor

yaakov-h commented Feb 9, 2016

Oh good catch, that's a Unicode EN-Dash.

So the new question is: Why does it work for me/AppVeyor/etc.? A less pedantic versions of Git?

@Dennis-Petrov
Copy link
Author

@yaakov-h: also, why it does require git / git repo at all now? Do we need to improve README.MD?

@yaakov-h
Copy link
Contributor

yaakov-h commented Feb 9, 2016

No idea, that's a question for @hubuk from #328.

@hubuk
Copy link
Contributor

hubuk commented Feb 9, 2016

@yaakov-h @Dennis-Petrov I used git update-index command to hide all changes made by build process to files in repository (version.cs and vsix manifests). It might also be achieved by a copy of a template file with entry in .gitignore but it would not work inside Visual Studio.
Most of the time I work with CodeContracts directly from git repository (I assume that most of us do). In such case executing buildCC.bat produced changes for files I did not want to commit. Using git add . was pretty hard. #328 was addressing this issue but I did not covered a situation when the source code is not on git repository or git is not available.

First commit in #376 fixes an invalid dash character. I was not building CC from VS2015 command prompt so did not encountered the issue before (command prompt for VS2013 works just fine even for the same version of git, so there may be something changed in MSBuild 14.0 regarding encoding).
Second commit in #376 adds condition before calling each git update-index. The condition is an error code returned by git rev-parse. Value of 0 means that git is available (command was run) and current directory is under git control.

I would like to ask you to take a look at this PR in case there are some other cases I not covered.

@Dennis-Petrov
Copy link
Author

@hubuk: Looks like there's another issue. I've finally build it, but without VB stuff. Literally, I had to remove these projects from solution and their output from WiX script:

Microsoft.VisualBasic.Compatibility10
Microsoft.VisualBasic10

because both of them can't resolve reference to Microsoft.VisualBasic.dll during build.

@hubuk
Copy link
Contributor

hubuk commented Feb 9, 2016

@Dennis-Petrov Could you provide a build log file?

@Dennis-Petrov
Copy link
Author

Sure. Added attachment.

build.zip

@hubuk
Copy link
Contributor

hubuk commented Feb 9, 2016

@Dennis-Petrov As @SergeyTeplyakov wrote, building from Visual Studio 2015 is not quite finished yet. Even if it was working before it produced invalid bits due to some rewriter issues with Roslyn (parts of CC are being rewriten too). Anyway, this is an easily reproducible on VS2015 command prompt build. It would be best to raise a separate issue for full VS2015 support with working tests.

@Dennis-Petrov
Copy link
Author

Shouldn't this issue be closed, since we're waiting for complete VS2015 support?

@hubuk
Copy link
Contributor

hubuk commented Feb 26, 2016

@Dennis-Petrov I think this issue may remain opened as a reference. But it is up to you.

@johncrim
Copy link

I've sent a PR with a couple fixes that allow me to build the project using VS 2015. The PR is associated with #471.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants