Closed WenyunZou closed 4 years ago
Might using different Microsoft.Build.dll
For dotnetstandard project (B): XXXX\NET_Framework_472_TargetingPack.4.7.03081.00\tools\v4.0.30319\reference_assemblies\v4.7.2\Microsoft.Build.dll
For dotnetcoreapp project (C): xxxxx.nuget\packages\microsoft.build\16.3.0\lib\netcoreapp2.1\Microsoft.Build.dll
As B&C are in the same solution, here's a list:
Just a guess.
Can you share a complete repro, including the application you're using to do the evaluation? The references in the image you shared look wrong to me, and adjusting your use of MSBuildLocator might help resolve the problem.
Thank you for your reply. I can't share the original one but attached is an example. please open demo.csproj in vs and run it. It prints nothing in the console, though the path to B.dll is expected.
I don't understand which version of dll I was using, might be an old one. But when I replace the Microsoft.Build.dll with the one in 16.3.0 nuget package, the problem solved.
Thank you very much!
Issue Description
tried to get "TargetPath" of a project programmally.
project.GetPropertyValue("TargetPath")
In dotnetcore project, it returns the correct path. In dotnet standard project, it returns string.empty.
Steps to Reproduce
create a c# dotnetstandard2.0 project A create a c# dotnetstandard2.0 project B create a c# dotnetcoreapp project C
coding in B&C:
Project project = new Project(pathToA);
string assemblyPath = project.GetPropertyValue("TargetPath");
Expected Behavior
assemblyPath is not string.empty
Actual Behavior
(no problem with A, its Taget Assembly is actually generated)
In B: assemblyPath is string.empty In C: assemblyPath is not string.empty
Analysis
No idea
Versions & Configurations