Fix FastFetch build in VS for Mac#1060
Conversation
Use Otherwise for Mac in FastFetch csproj
|
In the Stack Overflow post, I don't see a link to an issue in VSMac for this. Should we open an issue on their side (in monodevelop?) for this to track removing this workaround? |
That's a good idea, do you know where I can submit an issue to them? |
Historically, we've filed issues directly in their Github issues (see: mono/monodevelop#4837). This also seems like a 'Project Model' issue to me. |
nickgra
left a comment
There was a problem hiding this comment.
Approved with suggestions.
Thanks for getting to the root cause of what was actually broken here!
| </When> | ||
| <Otherwise> | ||
| <ItemGroup> | ||
| <ProjectReference Include="..\GVFS.Platform.Mac\GVFS.Platform.Mac.csproj" /> |
There was a problem hiding this comment.
Whenever Linux comes online, is there a way we can rework this code to keep VSMac working but load the Linux platform instead of the Mac one?
There was a problem hiding this comment.
Whenever Linux comes online, is there a way we can rework this code to keep VSMac working but load the Linux platform instead of the Mac one?
I found that the conditionals did work when using the build script, and so I suspect we could do something like:
<When Condition="'$(OS)' == 'Windows_NT'">
// Windows stuff
</When>
<When Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">
// Linux stuff
</When>
<Otherwise>
// Mac stuff
</Otherwise>
I was also discussing this with @jamill a bit and it would be nice if the condition was driven by the active configuration (e.g. Debug.Windows|x64) rather than the current platform that we're building on. So far I have not figured out how to do that, do you know if it's possible?
There was a problem hiding this comment.
Frankly, your proposed approach does not look too bad to me so long as we leave a comment on why it's like that.
So far I have not figured out how to do that, do you know if it's possible?
I have not seen any documentation that indicates picking up the active configuration is possible, although it would be very useful :) Even if it's supported on Windows, I wouldn't trust the VSMac .csproj parser to understand it.
There was a problem hiding this comment.
I did a bit of searching on this, but could not find a great solution for controlling this via the solution configuration.
One thing I was considering:
-
Could we define a property in
GVFS.propsthat specifies which target OS we are building for, and put all the logic for detecting this in there? That way, all other projects could key off the value of this property. (e.g.TargetOSPlatformor something? -
While not accessible from the IDE, we could build for a specific platform from MSBuild (or dotnet build) via
/p:TargetOSPlatform=macOSor/p:TargetOSPlatform=Windows..., or possibly via an environment variable?
There was a problem hiding this comment.
so long as we leave a comment on why it's like that.
Comments added!
Could we define a property in GVFS.props that specifies which target OS we are building for, and put all the logic for detecting this in there?
I think that sounds good. If/when we need to add checks like this in a second project we should see if we can get this logic in a common spot.
we could build for a specific platform from MSBuild (or dotnet build) via /p:TargetOSPlatform=macOS or /p:TargetOSPlatform=Windows..., or possibly via an environment variable?
It looks like we're pretty close to this today:
Windows
SET SolutionConfiguration=%Configuration%.Windows
%msbuild% %VFS_SRCDIR%\GVFS.sln /p:GVFSVersion=%GVFSVersion% /p:Configuration=%SolutionConfiguration% /p:Platform=x64 || exit /b 1
Mac
dotnet build $VFS_SRCDIR/GVFS.sln --runtime osx-x64 --framework netcoreapp2.1 --configuration $CONFIGURATION.Mac -p:CopyPrjFS=true /maxcpucount:1 /warnasmessage:MSB4011 || exit 1
Fortunately the command line builds haven't had any issues, it's been with the VS for Mac IDE specifically.
Thanks! I've filed mono/monodevelop#7417 for this. |
The
ItemGroupconditions are not working properly in VS for Mac (I noticed this reported on StackOverflow for VS 7.5.3 and so we don't appear to be the only ones having this issue).To work around this limitation I've switched the project to use.
Choose/Where