Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio 2017 15.6 problem with files appearing multiple times in a project #50

Closed
mitza-oci opened this issue Mar 12, 2018 · 7 comments

Comments

@mitza-oci
Copy link
Member

Updating from 15.5 to 15.6 revealed that VS2017 is interpreting vcxproj files differently now. When we have something like Qt MOC that processes a C++ header, it gets listed as both a regular header and a custom step input. The new VS2017 fails to load the project with "Cannot load project with duplicated project items"

@mitza-oci
Copy link
Member Author

FWIW this really is a VS bug. Certainly breaking it in the 15.5 -> 15.6 update is really unfortunate. Perhaps Microsoft will fix some time in the future. In the meantime we can try to work around it.

The problem appears when the same file is both a custom input and some kind of file that's built-in to MPC (documentation_files, header_files, etc.). VS2017 (version 15.6 and up) is rejecting these projects the way that MPC is current generating them.

I think we need a rule like this (so we couldn't depend on order):
a. built_in / custom (no output) => built_in
b. built_in / custom (with output) => custom

use-case a. is a README that's in Documentation_Files and in InstallData_Files
use case b. is the Qt Moc and Header_Files example

It wouldn't be too much of a problem to treat a as if it was b, but we wouldn't want to do the opposite. A special case of b. occurs with Source_Files, this is just plain broken in VS -- not sure what we can do.

MPC's template language could be extended with a keyword lists_contain to be used like:

<%if(!lists_contain(documentation_files, header_files, template_files, custom_type->input_file)%>

@mitza-oci
Copy link
Member Author

From a Microsoft representative on the issue

If you want previous behavior you can disable vc project cache in Tools - Options - Projects and Solutions - VC++ project settings

That may be an option for the complex cases like Qt. The easier ones (that we know of) are fixed in the ACE_TAO repo. Would still be good to have a general(-ish) fix in MPC, for full compatibility it must be fixed in Visual Studio.

@mitza-oci
Copy link
Member Author

This is still a problem in VS2019

@ocielliottc
Copy link
Contributor

I chose to go the route of preferring the custom build listing over the built-in listings for simplification. It allowed me to put a check in the foreach loops for template_files, header_files, inline_files, documentation_files, and resource_files to only list files if they are not custom type input files.

Fri Jun 28 15:52:37 UTC 2019 Chad Elliott elliottc@objectcomputing.com

    * modules/TemplateParser.pm:

      Added a template function, is_custom_input, which takes a file
      as the parameter and checks it against all custom input files.  It
      returns true/false when used in a <%if()%> context.

    * templates/vc10.mpd:

      Use the 'is_custom_input' function template to ensure that files
      listed as custom type inputs are not listed under template_files,
      header_files, inline_files, documentation_files, or resource_files.
      If a custom type input is also listed under source_files, we will
      leave it to the user to resolve this externally.

      This is technically only required for certain versions of vs2017 and
      vs2019, but in order to provide this functionality for just those
      two types would require a duplication of the vc10 template with a
      few minor adjustments.  Future fixes to the vc10 template would have
      needed to have been propagated to the slightly different vs2017
      template.  To simplify maintenance, I just made the changes to this
      template file.

@mitza-oci
Copy link
Member Author

@ocielliottc should this issue be closed?

@ocielliottc
Copy link
Contributor

As long as you're not seeing the issue anymore, I believe it can be.

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

No branches or pull requests

3 participants