-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Bug when using MSBuild with custom target since NET5.0 update #5875
Comments
Team Triage: Can you confirm the versions of MSBuild and SDK you"re using? It sounds like you"re using an older MSBuild with a newer SDK. |
I thought that was the case, but if I enumerate the MSBuild version being
found and selected by the MSBuildLocator, it correctly points to the
5.0.100 one under the dotnet/sdks folder.
…On Wed, Nov 11, 2020, 5:50 PM Ben Villalobos ***@***.***> wrote:
Team Triage: Can you confirm the versions of MSBuild and SDK you"re using?
It sounds like you"re using an older MSBuild with a newer SDK.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5875 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDCOA3B663VLZVNOHI4CX3SPK6FTANCNFSM4TR63KUA>
.
|
Very strange, can you post the output of I can"t seem to repro it from sdk version |
Hi, I"m getting the same error as @hellodeibu on Visual Studio for Mac. I have a project is targeting net48 and the Xamarin project is targeting netstandard2.0. Does anyone have a solution? Edit:
|
@emmanuel128 @hellodeibu could you post specifically your |
@benvillalobos apologies for not including that too: > dotnet --version
5.0.100
> msbuild -version
16.6.0.32601%
> dotnet msbuild -version
16.8.0.52002% Just in case this helps too: this is on Ubuntu 20.04 and with MonoDevelop 7.8.4 (build 2) installed. Edit: small addendum; I had completely removed and re-installed mono-related packages a few times, trying out different repositories and versions and whatnot. I ended with the nightly repository but I don"t think there"s anything in there that"s newer than whatever is in preview. I had the same results (failed to build, Monodevelop showing that odd string, etc.) with the I have removed and re-installed everything mono related from |
Same here, using the latest stable release of VS2019 Enterprise on Windows: **********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.8.0
** Copyright (c) 2020 Microsoft Corporation
**********************************************************************
>msbuild -version
Microsoft (R) Build Engine version 16.8.1+bd2ea1e3c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
16.8.1.52902
>dotnet msbuild -version
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
16.8.0.52002
>dotnet --version
5.0.100 Also in my case this happens when calling MSBuild programmatically with the h5 compiler. |
We"re curious if this may be a GAC issue. Please try repairing Visual Studio. This will at least eliminate that possibility. |
For those on Mono, this might be because Mono needs to be updated. Here is an issue tracking this: mono/mono#20250 |
Not Mono on my case as running on Windows. Already tried the VS repair but didn"t fix it either. And same issue happens when running dotnet build on linux so don"t think it"s the case. |
Tried to repro again and not seeing any issues:
@theolivenbaum could you try building a tiny project (via The project I"m building to try and repro this is simply: <Project>
<PropertyGroup>
<TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetPlatformIdentifier>h5</TargetPlatformIdentifier>
<TargetPlatformVersion>2.0</TargetPlatformVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworkIdentifier>$([MSBuild]::GetTargetFrameworkIdentifier("$(TargetFramework)"))</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v$([MSBuild]::GetTargetFrameworkVersion("$(TargetFramework)", 2))</TargetFrameworkVersion>
</PropertyGroup>
<Target Name="HelloWorld">
<Message Text="Hello World!" Importance="High"/>
</Target>
</Project> Note that this does fail with your error if I You mentioned MSBuildLocator is finding the correct MSBuild, can you verify this? I ask because this issue (should) only come up if you were using an older MSBuild wth a newer sdk somehow. What may be the most helpful in this scenario:
|
Tried to reproduce the issue today - but I"m not seeing it anymore, even when reverting the recent commits on the h5 compiler and SDK targets. Wondering if the update to VS 2019 16.8.1 that came immediately after 16.8.0 fixed the problem meanwhile and this was indeed a GAC cache issue... |
@theolivenbaum It happens 🙂 Edit: The PR that fixed this automatically unGAC"s MSBuild assemblies at install/repair time. #5626 Closing this issue out. For those running on mono, see this issue: mono/mono#20250 |
For future readers. (On a Mac). I updated (added) (only) dotnetcore SDK 5.0, and started getting this error.
Our work machines are fairly "locked down", so I do these upgrades one by one to easy trouble shooting if anything goes wrong. Below image was what was shown when I did a "upgrade" (aka, below is the newer version at the time of writing) After I did a Visual Studio Update (March 2021 timeline (again, above image)), I opened up my solution, and everything was ok in the nuget restore world. Below is the complete "About VS" information... of the later-working version of VS. I still have a few not-yet-done upgrades....but some of those are outside of the project-types I work on. ` Version 8.9 (build 1651)
=== Mono Framework MDK === Runtime: === Roslyn (Language Service) === 3.9.0-5.21112.8+f3ff04378c972d435826e6181de364b3c0db8d14 === NuGet === Version: 5.8.0.6860 === .NET Core SDK === SDK: /usr/local/share/dotnet/sdk/5.0.103/Sdks === .NET Core Runtime === Runtime: /usr/local/share/dotnet/dotnet === .NET Core 3.1 SDK === SDK: 3.1.406 === Xamarin.Profiler === Version: 1.6.15.68 === Updater === Version: 11 === Xamarin Designer === Version: 16.9.0.316 === Apple Developer Tools === A valid Xcode installation was not found at the configured location: "/Library/Developer/CommandLineTools" === Xamarin.Mac === Version: 6.20.2.2 (Visual Studio Community) === Xamarin.iOS === Version: 13.20.2.2 (Visual Studio Community) === Xamarin.Android === Version: 11.0.2.0 (Visual Studio Community) === Microsoft OpenJDK for Mobile === Java SDK: Not Found Android Designer EPL code available here: === Android SDK Manager === Version: 16.9.0.22 === Android Device Manager === Version: 16.9.0.17 === Build Information === Release ID: 809001651 === Operating System === Mac OS X 10.15.7 ` |
Issue Description
I"m hitting a bug when consuming a custom project SDK target (http://nuget.org/packages/h5.target):
The code in the targets file that seems to be triggering this issue is the following:
If I manually force the properties to the expected (or dummy) values, so that we avoid the GetTargetFrameworkIdentifier, GetTargetFrameworkVersion, GetTargetPlatformIdentifier and GetTargetPlatformVersion calls above:
Then the compilation using MSBuild works fine.
Any ideas?
The text was updated successfully, but these errors were encountered: