Skip to content

Conditions in Directory.Build.props fail #1067

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

Closed
Lakritzator opened this issue Feb 14, 2019 · 1 comment · Fixed by #2423
Closed

Conditions in Directory.Build.props fail #1067

Lakritzator opened this issue Feb 14, 2019 · 1 comment · Fixed by #2423
Assignees
Milestone

Comments

@Lakritzator
Copy link

While trying out the most recent changes which allow benchmarking with dotnet core 3.0 desktop project, which btw, work GREAT, I noticed that when running BenchmarkDotNet I get errors for Tasks which should not run!

Those tasks have conditions which are normally not met but for the benchmark project they did.
I deleted the tasks, the benchmark ran without issues.

The cause was this ItemGroup:

  <ItemGroup Condition="!$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo'))">
    <PackageReference Include="PdbGit" Version="3.0.41">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
  </ItemGroup>

While thinking about this, I noticed that the conditions are on the MSBuildProjectName. I believe that the temporary generated projects get a GUID as name, which causes my condition to return "true" (does not contain Test).

The workaround for me, is to delete the ItemGroup manually, which is okay for now.

I wanted to discuss a possible solution, while I believe there is no perfect solution I was hoping for a compromise.

I would suggest that we change the project names to have the original name in it, extended with the GUID. The main question is how, and this should be documented.

Suggestions:

  • MSBuildProjectName-GUID
  • GUID-MSBuildProjectName

Maybe you have some other ideas?

I will be more than happy to supply an example repository if this helps, but I could imagine that the case is quite clear? I can also take a look at writing a PR, I just wanted to get into a small discussion before doing so, not that things move into the wrong direction.

@adamsitnik adamsitnik added this to the v0.13.x milestone Oct 23, 2020
@timcassell

This comment was marked as outdated.

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

Successfully merging a pull request may close this issue.

3 participants