eXpandFramework / eXpand

DevExpress XAF (eXpressApp) extension framework. ๐—น๐—ถ๐—ป๐—ธ๐—ฒ๐—ฑ๐—ถ๐—ป.๐—ฒ๐˜…๐—ฝ๐—ฎ๐—ป๐—ฑ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ.๐—ฐ๐—ผ๐—บ, ๐˜†๐—ผ๐˜‚๐˜๐˜‚๐—ฏ๐—ฒ.๐—ฒ๐˜…๐—ฝ๐—ฎ๐—ป๐—ฑ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ.๐—ฐ๐—ผ๐—บ and ๐˜๐˜„๐—ถ๐˜๐˜๐—ฒ๐—ฟ @๐—ฒ๐˜…๐—ฝ๐—ฎ๐—ป๐—ฑ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ and or simply ๐—ฆ๐˜๐—ฎ๐—ฟ/๐˜„๐—ฎ๐˜๐—ฐ๐—ต this repository and get notified from ๐—š๐—ถ๐˜๐—›๐˜‚๐—ฏ
http://expand.expandframework.com
Microsoft Public License
222 stars 115 forks source link

How I got eXpand working on MacOS Visual Studio 2022 Preview. #910

Closed dsikic closed 11 months ago

dsikic commented 2 years ago

๐—œ๐˜€ ๐˜†๐—ผ๐˜‚๐—ฟ ๐—ณ๐—ฒ๐—ฎ๐˜๐˜‚๐—ฟ๐—ฒ ๐—ฟ๐—ฒ๐—พ๐˜‚๐—ฒ๐˜€๐˜ ๐—ฟ๐—ฒ๐—น๐—ฎ๐˜๐—ฒ๐—ฑ ๐˜๐—ผ ๐—ฎ ๐—ฝ๐—ฟ๐—ผ๐—ฏ๐—น๐—ฒ๐—บ? ๐—ฃ๐—น๐—ฒ๐—ฎ๐˜€๐—ฒ ๐—ฑ๐—ฒ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฏ๐—ฒ. I understand that very few people have thought about using VS on Mac, so this is quite niche. However, if you find yourself with an M1 (arm) based Mac or MacBook, you'll soon discover that running Visual Studio inside of parallels doesn't perform well. In fact Microsoft gives you a warning when the installer is running.

Visual Studio for Mac is actually a decent experience when Developing XAF Blazor, but it breaks as soon as eXpand NuGet dependencies are introduced. Visual Studio will throw a build error saying it cannot find Powershell.exe and also that running powershell.exe, with a bunch of parameters failed.

To get around this issue you can install PWSH using the following guide. It's quick, just install brew, then use brew, then add to path.

Installing PowerShell on macOS

Once this is done, I experimented with adding a shell alias for powershell.exe, but visual studio doesn't pick it up so that didn't yield any results.

However, once you have PWSH installed if you double click the error in Visual Studio for Mac it will take you to the *.targets file where the following command exists.

`<?xml version="1.0" encoding="utf-8"?>

` Simply replace Powershell.exe with pwsh, and save the file. Then build solution again, and everything should work fine. ๐——๐—ฒ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฏ๐—ฒ ๐˜๐—ต๐—ฒ ๐˜€๐—ผ๐—น๐˜‚๐˜๐—ถ๐—ผ๐—ป ๐˜†๐—ผ๐˜‚'๐—ฑ ๐—น๐—ถ๐—ธ๐—ฒ I would like the existing scripts to detect whether they are on Windows, and if they're not, then default to pwsh instead of powershell.exe. Ideally they should remind the user to install pwsh using the link above, if that command also fails.
dsikic commented 2 years ago

@apobekiaris if you point me in the right direction, I'm happy to implement this myself in a pull request. Just not sure where the scripts are all stored.

apobekiaris commented 2 years ago

better idea is to disable the scripts once in MacOs cause they do actually nothing. The latest version already has VersionConverter.ps1 disabled

https://github.com/eXpandFramework/Reactive.XAF/blob/lab/tools/Xpand.VersionConverter/Xpand.VersionConverter.ps1#L17

VersionConverter support stopped as we got into this .NetFramework hell, meaning when .net5/.netcore was introduced. CopySymbols copy the symbols from Nuget dir into path, howewver symbols are only working in windows, so tottally of no use.

YOu can add a returbn at the start of the script and test?

Happy to accept a PR if u can test detecting non Windows should be trivial as per c#

note pwsh is c# actually with a different syntax so u could

[System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows)
$IsWindows

or https://stackoverflow.com/questions/64893785/how-to-detect-linux-or-macos-or-windows-in-powershell

let me know if u require more help

expand commented 11 months ago

Closing issue for age. Feel free to reopen it at any time.

.Thank you for your contribution.