Open Nirmal4G opened 6 years ago
cc @rainersigwald According to the docs it shouldn't happen, so is it a bug on just .NET Core side?
Can you elaborate on what problem you're observing as a result of this?
For my scenarios, I use custom sdks in many of my projects. When authoring some of them I found that, in the docs, MSBuildExtensionsPath
should not have \
backslash at the end. So, my and possibly others' targets use it like this: $(MSBuildExtensionsPath)SomeFolder\SomeBuildProcess.targets
.
When those targets gets shared, let's say, by using msbuild.exe
instead of dotnet (ms)build
it breaks the build process, since the path becomes like this: C:\Program Files\MSBuildSomeFolder\SomeBuildProcess.targets
.
Basically, this a huge behavioral change, sure people are not directly using MSBuildExtensionsPath
anymore, but I've seen code in wild, that leads to many build problems, especially for new people familiarizing with dotnet msbuild
and authoring custom sdks!
I remain confused, thanks for being patient with me.
If the spec is that it does not have a trailing slash, wouldn't you need to always call it with a slash? To use your example $(MSBuildExtensionsPath)\SomeFolder\SomeBuildProcess.targets
?
It's because .NET Core
version don't have the slash. And most people are not looking at the docs, they are learning these from the tools they installed, so if they learn from the tool (.NET Core SDK
) that's displaying wrong value, instead of what's in the spec, they write incompatible code, inturn makes the build break!
Steps to reproduce
Set to any simple project in a directory and execute
msbuild
anddotnet msbuild
Examine the
.binlog
file usingMSBuild Structured Log Viewer
..NET Core mode:
.NET Framework mode:
Expected behavior
MSBuildExtensionsPath
should not have\
backslash at the end!Actual behavior
MSBuildExtensionsPath
has\
backslash at the end only when run in .NET Core mode!Environment data
dotnet msbuild /version
:msbuild /version
:OS info:
dotnet --info