はじめに
今回はVisual Studio for Macのインストール手順をまとめてみました。
Windowsアプリの開発で、C#を使ったことがある方はいると思います。
そのC#で、Macのアプリケーションを作成してみたいと思います。
本記事ではインストール方法と、簡単なアプリを実装してみます。
本記事はMac向けではありますが、Windows版の記事は以下をご覧ください。
他にも私のブログで、C#について解説している記事がありますのでご覧ください。
【紹介】個人開発
Mac向けの、定型文の挿入も可能なクリップボード履歴管理アプリです。
Windows版は以前からありましたが、基本的な使い方はMac版も同じですので、もしよかったらダウンロードしてみてください。
Visual Studio 2019のインストール
Visual Studio 2019 for Macをインストールしてみましょう。
Microsoft Visual Studio(マイクロソフト ビジュアル スタジオ)は、マイクロソフトが開発・販売している統合開発環境(IDE)である。Microsoft Windowsオペレーティングシステム、Windowsデバイスドライバー、Windowsサービス、アプリケーションソフトウェア(デスクトップアプリ、UWPアプリ、モバイルアプリ)、Webサイト、Webアプリ、Webサービスなどの開発に使用されている。
https://ja.wikipedia.org/wiki/Microsoft_Visual_Studio
インストーラをダウンロードしましょう。
「Visual Studio for Macをダウンロード」をクリックします。
![](https://chigusa-web.com/wp-content/uploads/cocoon-resources/blog-card-cache/dfa4aa82e1da0c9f2a0377aef4363715.png)
![](https://chigusa-web.com/wp-content/uploads/cocoon-resources/blog-card-cache/dfa4aa82e1da0c9f2a0377aef4363715.png)
![](https://chigusa-web.com/wp-content/uploads/cocoon-resources/blog-card-cache/dfa4aa82e1da0c9f2a0377aef4363715.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-12.27.13.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-12.27.13.png)
インストーラがダウンロードされましたので、ダブルクリックで起動します。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-12.30.01-1024x127.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-12.30.01-1024x127.png)
インストーラが起動しますので、Install Visual Studio for Mac.appをダブルクリックします。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.37.05-300x299.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.37.05-300x299.png)
警告が表示されますが、「開く」をクリックしました。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.38.58-500x450.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.38.58-500x450.png)
インストーラが起動します。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.39.11-500x369.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.39.11-500x369.png)
続行をクリックします。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.39.36-500x336.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.39.36-500x336.png)
インストールする内容を選択します。
「.NET」と「macOS」を選択しました。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.42.15-1024x756.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.42.15-1024x756.png)
インストールが始まります。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.42.25-1024x756.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.42.25-1024x756.png)
macOSを選択したためか、以下の画面が表示されました。
とりあえず後でインストールしますので、「完了」ボタンをクリックしました。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.50.33-1024x756.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.50.33-1024x756.png)
起動時に以下の画面が表示されますが、任意で設定します。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.52.20-1024x681.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.52.20-1024x681.png)
![img-border-none](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.52.25-1024x681.png)
![img-border-none](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.52.25-1024x681.png)
プロジェクトの作成
インストールが完了しました。
新しいプロジェクトを作成しますので、新規をクリックします。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.52.53-1024x681.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.52.53-1024x681.png)
試しに、.NETのコンソールプロジェクトを選択しました。
![img-border-none](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.56.35-1024x780.png)
![img-border-none](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.56.35-1024x780.png)
プロジェクトの保存場所を選択します。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.56.50-1024x741.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.56.50-1024x741.png)
Visual Studioが起動しました。思ったよりシンプルな画面でした。
おなじみのC#のコードです。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.57.11-1024x635.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.57.11-1024x635.png)
実行ボタンをクリックします。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.26.22.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.26.22.png)
アプリケーションが実行され、コンソールにメッセージが表示されました。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.58.25.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-16.58.25.png)
macOSアプリの作成
試しにMacアプリを作成してみます。
Xcodeが必要になりますので、App Storeからインストールします。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.07.13.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.07.13.png)
新規プロジェクト作成で、Cocoaアプリを選択します。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.36.19-1024x780.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.36.19-1024x780.png)
Macアプリの構成を選択します。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.36.32-1024x785.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.36.32-1024x785.png)
新しいCocoaアプリの構成を入力します。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.36.50-1024x741.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.36.50-1024x741.png)
Visual Studioが起動しました。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.37.00-1024x647.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.37.00-1024x647.png)
ビルドを行い実行すると、空のフォームが起動しました。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.37.21-500x346.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.37.21-500x346.png)
フォームのデザイナーはストーリーボードで行うようです。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.37.35-1024x673.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.37.35-1024x673.png)
DEBUGでビルドしましたが、フォルダにはappファイルが作成されていました。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.46.43-1024x311.jpg)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-17.46.43-1024x311.jpg)
Visual Studio 2022 for Mac
Visual Studio 2022 for Macは、現時点でプレビュー版でした。
今後、正式版が公開されたら試してみたいと思います。
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-20.19.57-1024x681.png)
![](https://chigusa-web.com/wp-content/uploads/2022/04/ScreenShot-2022-04-24-20.19.57-1024x681.png)
さいごに
C#は非常に習得しやすく、手軽にWindowsアプリケーションを作れますので、おすすめです。
他にも私のブログで、C#について解説している記事がありますのでご覧ください。
コメント