GitTools / GitLink

Making .NET open source accessible!
MIT License
554 stars 86 forks source link

Gitlink failes on projects referencing Shared C++ (*.vcxitems) projects. #194

Open rjmporter opened 6 years ago

rjmporter commented 6 years ago

IF BUG, INCLUDE THIS PART:

Steps to reproduce

  1. Create a Solution
  2. Create a dll.vcxproj c++ dll project
  3. Create a shared.vcxitems, c++ shared project, containing at least one compile-able item.
  4. Add a reference to the shared.vcxitems project in the dll.vcxproj.

Platform: .NET version: native c++

Expected behaviour

vcxitems project are simply evaluated as

<Import Project='<project>.vcxitems' /> 

in the msbuild vcxproj script. They are not built, but exist to allow inclusion of common code to be compiled into multiple C++ executable binaries, these should not behave differently than other remotely referenced .targets or .props files.

Actual behaviour

Build server output

[10:42:11][Step 2/2] PdbStr found at C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64\srcsrv\pdbstr.exe (using the registry=True)
[10:42:11][Step 2/2] ScrTool found at C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64\srcsrv\srctool.exe (using the registry=True)
[10:42:11][Step 2/2] An unexpected error occurred | [TargetInvocationException] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Build.Exceptions.InvalidProjectFileException: The project file "project.vcxitems" is in the ".vcproj" file format, which MSBuild no longer supports. Please convert the project by opening it in the Visual Studio IDE or running the conversion tool, or use MSBuild 3.5 or earlier to build it.
[10:42:11][Step 2/2]    at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
[10:42:11][Step 2/2]    at Microsoft.Build.Construction.SolutionParser.ParseFirstProjectLine(String firstLine, ProjectInSolution proj)
[10:42:11][Step 2/2]    at Microsoft.Build.Construction.SolutionParser.ParseProject(String firstLine)
[10:42:11][Step 2/2]    at Microsoft.Build.Construction.SolutionParser.ParseSolution()
[10:42:11][Step 2/2]    --- End of inner exception stack trace ---
[10:42:11][Step 2/2]    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
[10:42:11][Step 2/2]    at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
[10:42:11][Step 2/2]    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[10:42:11][Step 2/2]    at SolutionExplorer.Helpers.ProjectHelper.GetProjects(String solutionFile, String configurationName, String platformName, List`1 failedProjects) in D:\BuildAgent2\work\5c7df25066fb2bb3\src\Tools-Windows-Lib-SolutionExplorer\Helpers\ProjectHelper.cs:line 159
[10:42:11][Step 2/2]    at GitLink.Linker.Link(Context context)

Work around If the items from the shared project are simply added to the vcxproj file from their location in the the vcitems project (Project-> Add Existing Item -> Browse to .vcxitems .cpp, .rc, and *.h files), this does not fail.