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

Sometimes does not show properties under projects #488

Closed
MarkKharitonov opened this issue May 2, 2021 · 4 comments
Closed

Sometimes does not show properties under projects #488

MarkKharitonov opened this issue May 2, 2021 · 4 comments

Comments

@MarkKharitonov
Copy link

MarkKharitonov commented May 2, 2021

I have a logic that imports a targets file if a certain property is True. I can clearly see the targets are imported, but searching for the property under the project node returns nil. I know for sure the property is not globally set - it is determined from another targets file based on the csproj file contents.

Exhibit 1
image

This tells us the property IsUnitTestProject is indeed set to true.

Exhibit 2
image

The property only shows up under certain projects (but not the one I am interested in!) and only in the context of the restoration phase. This is when msbuild is invoked in a separate context (to the best of my limited understanding) and it presents a picture as if the property IsUnitTestProject is global. But it is not, which is easily proved by examining the top level solution node.

Exhibit 3
image

The property IsUnitTestProject is defined in Tests.props, which is clearly loaded under the project in question - see the next exhibit.

Exhibit 4
image

The binary log is attached.

P.S.
It would be nice if we could use quotes when searching for $import to indicate the project name exactly.

msbuild.zip

@KirillOsenkov
Copy link
Owner

Good news, this will be fixed in MSBuild 16.10 with this PR:
dotnet/msbuild#6287

Filed #489 for the $import quotes support

@KirillOsenkov
Copy link
Owner

Here's a screenshot: you can tell whether a given project has Properties and Items information by the presence of the green TargetFramework label:
dotnet/msbuild#6287 (comment)

We can infer the target framework by reading the TargetFramework(s) property.

@MarkKharitonov
Copy link
Author

This is excellent. Looking forward for that.

@KirillOsenkov
Copy link
Owner

Try out Visual Studio 16.10 preview 3.

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

2 participants