-
Notifications
You must be signed in to change notification settings - Fork 64
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] Visual Studio cannot open projects due to "Invalid static method invocation syntax" errors #548
Comments
I am having the same issue in our build pipeline that uses msbuild. @jgbright Does the commit in your forked repo fix the issue? |
It seems to break when run with |
This is interesting! I wonder if there is some versioning issue. @tzuge have you seen something like this crop up? |
No, I haven't hit this issue. We're building in github actions using the I recall there is some weirdness on tool stacks in dotnet. Visual Studio might use its own thing, then msbuild cli is/was part of Windows SDK?, and dotnet cli is in dotnet SDK? I suspect it would be some version thing related to those various cli build tools. |
Yeah, I imagine it is related to the versioning of one of those pieces.... Is there a way that we could check if the methods are defined before invoking them? I understand that it would get longer, but we could always tuck these variable declarations away in node_modules/@nx-dotnet/core/presets or similar and reference them in the generated files. |
I think perhaps the right approach is to check dotnet cli tool versions in the init generator and fail with helpful message if not in the supported range. i.e. run |
Keep in mind you can specify what version of the dotnet tool chain to use with a global.json file. I wonder if that’s why I see the problem and others do not. |
Yeah, we can definitely define a supported version of the toolchain... I generally tend towards being more open with the .NET SDK version installed, and doing some mapping as required here and there (most notably, the format executor handles a lot of this). Its more work on our side of things, but I tend to find that in the .NET land dev's are not always super up to date on their tooling versions. @jgbright and @remkoboschker Can yall run |
Sure.
|
dotnet 6.0.402 works fine with |
That's quite interesting.... I'll do some digging and see if I can narrow down why GetRelativePath isn't present in those versions. I'll see if I can't figure out either minimum defined versions or similar. |
This one might be relevant: dotnet/sdk#1967 I get the impression that there might be a few scenarios in which msbuild cannot resolve the system assemblies leading to this error. I believe it would help to know:
|
Just replace |
You sir just made my day... just stumbling on your reply when I needed it /salute This works btw ;) |
🎉 This issue has been resolved in version 1.16.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
If I had known you guys were so receptive to pull requests, I would have just submitted the change I made myself. Thanks for submitting it for me @pedrolamas. |
There's a leftover issue on windows caught by our smoke tests, but its unrelated to this PR. Pushing a fix now. @jgbright I try to be receptive to PRs in particular, as I don't have a ton of time to spend working on the plugin, unfortunately, and any contributions help immensely. In this particular case, I didn't ask for a PR at first as I prefer the In any case, the MSBuild namespaced method appears to be working properly, so we will continue with it for now. |
Thanks @jgbright, but being honest, I only now noticed you mentioned it in your original issue as a possible solution! 😁 This is a trick I've used some times in the past when I was still doing Windows Development (though I can't say I miss those days that much, tbh!) |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Describe the bug
I get errors when I try to open a dotnet project with Visual Studio 2022 community edition that uses the
Directory.Build.props
andDirectory.Build.props
files generated by nx-dotnet.To Reproduce
Steps to reproduce the behavior:
Environment:
Possible solution
I found the relevant documentation and it says any function in the System.IO.Path class should be invokable from these "property functions." So, it should work. It doesn't work on my box. There is another option that does work on my box and that's [MSBuild]::MakeRelative, which looks to be a drop-in replacement for
[System.IO.Path]::GetRelativePath
in this context.This is the change I've made on my projects. I'm happy to submit a pull request if that helps.
The text was updated successfully, but these errors were encountered: