-
-
Notifications
You must be signed in to change notification settings - Fork 731
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
Cannot convert from 'Cake.Common.Tools.MSBuild.MSBuildSettings' to 'Cake.Common.Tools.DotNetBuildSettings' #849
Comments
WithPropery takes string/strings as value parameter, you're passing a FilePath to it. Could be some implicit thing that happens when wrong type is supplied. |
Yep, for some reason the compiler want's to use the DotNetBuildSettings extension instead. I though the MakeAbsolute alias returned a ConvertableDirectoryPath/ConvertableFIlePath, hence the no string conversion. But after checking source, I was wrong 😄 |
@mholo65 you could try launching cake.exe with the -Experimental flag which will launch a newer version of Roslyn, might be an issue that's sorted, if it's an compiler issue. |
@devlead Same error, slightly different error message:
I would however call this an compiler issue. It may be solved by moving DotNetBuildSettings (and aliases) to another namespace than Cake.Common.Tools |
Same issue with XBuild. But when switching to DotNetBuild, the compiler gives correct error message:
|
@mholo65 Excellent finding this. If you have time, could you check if your theory about moving DotNetBuild to another namespace would solve the problem? |
@patriksvensson np. So I tried moving to namespace Cake.Common.Tools.DotNet still same issue. Which makes sense in a way, because that namespace is loaded before Cake.Common.Tools.MSBuild/Cake.Common.Tools.XBuild in cake-script. If moving to namespace Cake.Common.Tools.ZotNet I'll get the correct error for MSBuild
But then again XBuild reports
Becouse the MSBuild namespace is loaded before XBuild. Now if I add an extension method
Soo, the bottom line is: We are importing unnecessary namespaces. Might be difficult to fix, would still say that this is an Compiler issue (finding other methods with same name but slightly different signature and trying to implicitly cast.). Root cause is user error (trying to cast DirectoryPath/FilePath to string), but It would be great to get the correct error message. The MSBuild/XBuild/DotNetBuild could be easy to fix using inheritance though. |
FYI, just hit this so problem still exists in 0.23.0 |
I think we was ready to remove |
That'll do it 😄 |
Steps to reproduce:
This will output error message:
Workaround add ToString()
The text was updated successfully, but these errors were encountered: