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

Need way to detect Common targets #179

Open
clairernovotny opened this issue Aug 19, 2019 · 0 comments
Open

Need way to detect Common targets #179

clairernovotny opened this issue Aug 19, 2019 · 0 comments

Comments

@clairernovotny
Copy link
Collaborator

We have a need to detect if the specified LanguageTargets file was successfully imported (because it existed).

We had been doing something like this:

  <PropertyGroup>
    <MSBuildAllProjects Condition=" '$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0' ">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
  </PropertyGroup>

  <!-- Need to detect if the expected targets where actually imported and reset to common if not -->
  <PropertyGroup>
    <_SdkLanguageTargetsMissing Condition="$(MSBuildAllProjects.Contains('Microsoft.Common.targets')) ">false</_SdkLanguageTargetsMissing>
    <_SdkLanguageTargetsMissing Condition="'$(_SdkLanguageTargetsMissing)' == ''">true</_SdkLanguageTargetsMissing>
  </PropertyGroup>

However, that no longer works since MSBuildAllProjects isn’t set anymore. We was simply looking to see if Common targets was in the list. I can’t do a simple Exists() check earlier on because of the fallback location on Mono/MacOS. That special exists check only works in an Import block, so we can’t do a regular conditional on it to set the variable. Either the import succeeds or its skipped.

clairernovotny pushed a commit that referenced this issue Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant