-
Notifications
You must be signed in to change notification settings - Fork 651
MSBUILD : Task factory warning NMSBT010: There is a mismatch between SDK NuGet version (4.8.1) and the NuGet version the task factory was compiled against (4.8.0). There might occur some exotic errors. #1503
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
Comments
I'm getting the exact same warning with v4.0.1-beta1-26. Here is my
|
Bump. Affects us too. :) |
Still happens on |
Still happens in |
I've started seeing this as an ERROR now instead of the warning when using microsoft/dotnet:2.1-sdk
If I'm more specific then microsoft/dotnet:2.1.403-sdk works (with warning) but microsoft/dotnet:2.1.500-sdk fails with the error. |
@dazinator can you have a look? I guess you had this issue here stazz/UtilPack#19 |
@adamshergold afaik gitversiontask wont work on sdk >= 2.1.0 yet - there is an ongoing PR that adds support for sdk 2.1.0 and drops support for sdk 1.1.0 as it updates libgit2sharp dependency among other things, but this PR not yet merged. (note: Im talking about gitversiontask only. gitversion from comnand line (or dotnet global tool) should work on sdk 2.1.0 fine.) As for the warnings, for the most part, unless the msbuild version increment has snuck in breaking changes, then there shouldn't be any problems. I believe you can disable this warning - so simply disabling might be the best bet. I'll look up how best to disable it. |
@dazinator thanks for the update. I was successfully using 2.1:latest for a number of week (with warnings only) but at some point in the last week it started failing (so one of the recent SDK releases must have broken it). Apart from the warnings everything works very well so for now I'll just pin to 2.1.403 and carry on. thanks! |
Yep! Included like this in .fsproj file
Compilation is using CircleCI with docker image specified as microsoft/dotnet:2.1-sdk. Last time this compiled and worked (with warnings) was 2 weeks ago. I just re-triggered a build now (I hadn't made any commits in 2 weeks) and it fails with the error from previous comment. Thanks! |
We are also using
|
@dazinator I think all in this thread have been running But thanks for the heads up. We'll hold on updating to |
fyi this is raised over here: stazz/UtilPack#34 Ultimately, there is some exotic code in utilpack msbuild's task factory, that depends on nuget. However it can't know which version of NuGet MSBuild has already loaded (it depends upon the version of MSBuild being used, which depends on the version of the dotnet core sdk being used). This means it uses reflection and things to find the loaded nuget assembly and types and invoke methods. However what has happened here, is that there have been breaking changes in the NuGet API between these two versions, and so UtilPack is now failing. I am sure the UtilPack author would welcome suggestions on how UtilPack could overcome this here: stazz/UtilPack#34 |
Hi all, Yes, the The obvious solution would be to lock down the NuGet version and ship the assemblies with the task factory. That is actually how it is done in .NET Desktop version. However, on .NET Core, when one invokes One solution could be to use Another solution could be using the NuGetUtils.Tool.Exec/ .NET Core Global Tool. Since the global tools don't rely to be ran under To be honest, I don't have a clear solution for this. But I hope I've provided some starting points for a discussion about this. |
Related to the trusted framework assemblies: They're actually called "trusted platform assemblies". You can try the following in (git) bash:
IIRC, The fact that the assembly is in TPA list means that it won't be able to be loaded from different location again. This mechanism is the same how the normal (non- |
@stazz , thanks for the detailed clarifications. |
The 4.9.0-compatible version of UtilPack is now uploaded to nuget.org. It supports NuGet versions from Btw, while working on 4.9.0-compatible version of UtilPack, I checked for the NuGet assembly load behaviour, and it is still the same: the methods/events of |
With WorkaroundPlace a {
"sdk": {
"version": "2.1.403"
}
} Remove it when EDIT: One may also include, next to |
This should hopefully be fixed in the latest beta meaning if you update from nuget.org, you should no longer need to pin the sdk version. I'll leave this open until someone can confirm this. |
Yes - looks like it's fixed. Latest 2.1-sdk image works with no error/warnings against beta1-49 (at least for me). Thanks to all that contributed to fixing it! |
I've run with |
@Choc13 can you also conform it's working for you? |
Hi, I now seeing some errors. Although I should start by pointing out that I'm still using version 2.1.403 of the .NET SDK, so please let me know if this fix is only expected to work against the latest .NET SDK. Now the first error I encountered was:
I reference
The warning makes me think that this is because I need to update to the latest .NET SDK. Is that correct? |
The first error is a bit weird, and it is probably caused by the second error: The NuGet.Commands version 4.8.1 never got released to nuget.org ( nuget site has only versions 4.8.0 and 4.9.0-rtm.5658 ). My guess is that it tries to use 4.9.0-compiled task factory for 4.8.1 NuGet and that causes the 2nd line of 2nd error message. I really wasn't prepared for NuGet assemblies to be left out from nuget.org publishing route like that, and there is no clear strategy for the code to use to choose version. I guess I could match just major + minor version but that would most likely cause some new errors in the future. Another way would be to add support for some kind of environment variable to make the task factory use the version of itself which is compiled against NuGet version x.y.z, specified by the environment variable. |
I see thats annoying about the missing nuget publish! Sdk 2.1.500 is when the nuget binary compatibility was broken so it would be great (even if hard coded) for utilpack to only load the task factory compiled for 4.9.0 when on sdk >= 2.1.500. The previous task factory should work for less than sdk 500. Interesting idea about perhaps having a policy like matching on major and minor. Its annoying because semver dictates that breaking changes should increment major version number, but in this case with nuget there appears to be a breaking change but they only bump the minor version. I suspect part of the truth is they are trying to keep major version numbers aligned, and another part is they dont see a strict enough obligation to keep API's stable and backwards / binary compatible - in which case their stuff really should still be in prerelease status, but whatever the reason it seems not a proper use of semver in my view :-( which is a bit ironic that nuget themselves don't follow semver. |
The Sdk 2.1.500 includes the 4.9.0 version, and with that the UtilPack works ok. I'll try to release a new version this weekend, which would work with 4.8.1. How to get my hands on 2.1.403 SDK, by downloading correct docker image and copy the assemblies to mounted folder? :) |
You can get it from here: https://www.microsoft.com/net/download/dotnet-core/2.1 |
Thanks, that is suspiciously convenient looking site by MS! ;) I'll try to come up with something on sunday! |
@stazz like my workaround above, you can make a Globals.json file containing the desired SDK to run with. |
I've released a new version of the task factory, which uses smarter logic to choose version when there is no exact match. It now defaults to use Let me know how it goes - it successfully worked for me in my tests. It still prints out a message in any version mismatches, just not a warning if only build version is mismatched. |
4.0.1-beta1-50 has the latest version of Utilpack included. @Choc13 , @adamshergold , @LordMike , can you give it a try? |
Builds progress without issue with |
|
Excellent stuff. Let's close this for now based on that positive feedback ;-) |
I think I'm still getting issues related to this - using Exception is:
|
@kieranbenton can you raise the issue with utilpack and omnisharp over here: https://github.com/stazz/UtilPack |
Sure. Reported as: stazz/UtilPack#35 |
@arturcic 4.0.1-beta1-50 works fine for me with microsoft/dotnet-sdk:latest so all good! |
@adamshergold do you mind me asking what dev environment you use? VS.NET or vscode? |
@kieranbenton : I develop on a mac using the dotnet sdk (local install) using JetBrains Rider IDE. For CI builds I'm using CircleCI using the microsoft/dotnet-sdk docker image for building. Happy to share more details if helpful for you! |
Yeah @kieranbenton 's stack trace is from .NET Desktop version. Interesting, I wonder how and what got broken. Omnisharp has been known to be a little tricky based on @dazinator 's few months old issue. I'll discuss more in issue @kieranbenton opened. :) |
@stazz just to be clear (and will continue with this in the other ticket) but this is .NET Core 2.1 NOT '.NET desktop' |
@dazinator do you want to reopen this issue or shall I open a new one here for this? This is definitely a problem - and I'm using what I'd consider a pretty common setup. |
If you are just seeing a build warning due to version mismatch, but the build suceeds then this is expected in some situations. It should be possible to disable the msbuild warning if it annoys you. If however you are also seeing an error (i.e with the task factory) then please open a new issue and detail your stack (or provide repro)! Cheers! |
@kieranbenton im addition to above, didn't you already open OmniSharp/omnisharp-roslyn#1350 for your issue? (Assuming its omnisharp) |
Hi,
I have just updated a .NET Core project to Gitversion.Task 4.0.0. It seems to be working fine and it's nice to see this now working with the .NET Core SDK enabling us to call
dotnet build
and have versioning work. Great job!However, there are some warnings generated by the tool. Namely:
This is only a warning and doesn't cause the build to fail and as far as I can tell there are no issues with the version numbers being generated. However, I did notice #1467 and I wonder if this NuGet version mismatch is going to be a problem every time there is an update to the NuGet version in the .NET Core SDK. I do not have any experience building tools for the .NET Core SDK so I have no idea what the best practice is here for avoiding these kinds of warnings. I can imagine it would be a pain to have to release this library every time NuGet is updated in the .NET Core SDK.
For reference the .NET Core SDK version I am using is 2.1.403. Our Travis build uses the same SDK version and reports the same warnings, however AppVeyor is using 2.1.402 and doesn't report any warnings.
The text was updated successfully, but these errors were encountered: