😀

ベータ版の Project IDX で .NET 6 と Azure Functions の開発環境を作ってみた

に公開

Google から Project IDX という、ブラウザベースの IDE が発表されました。テンプレートが用意されている開発環境以外に、自分が用意した構成で開発環境を動かせるようなので、早速 .NET 6 と Azure Function 用の開発環境を作ってみました。

ローカルで検証用 Azure Functions を作成

bash
prefix=mnridxfa

func init $prefix --dotnet

cd $prefix

func new --name ${prefix}http --template HttpTrigger

Project IDX 用の構成ファイルを作成

bash
mkdir .idx

cat <<EOF > .idx/dev.nix
# see: https://developers.google.com/idx/guides/customize-idx-env
{ pkgs, ... }: {
  # Which nixpkgs channel to use.
  channel = "stable-23.11"; # or "unstable"
  # Use https://search.nixos.org/packages to find packages
  packages = [
    pkgs.dotnet-sdk
    pkgs.azure-functions-core-tools
    pkgs.azure-cli
  ];
  # Sets environment variables in the workspace
  env = {};
  idx = {
    # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
    extensions = [
      # "vscodevim.vim"
    ];
  };
}
EOF

GitHub のプライベートリポジトリにプッシュ

bash
rm -rf .vscode

sed -i 's/local.settings.json/# local.settings.json/g' .gitignore

git init

git add -A

git commit -m "first commit"

git branch -M main

git remote add origin https://github.com/mnrst/mnridxfa.git

git push -u origin main

Project IDX の初期設定

https://idx.google.com/

https://idx.google.com/ にアクセスします。

import a repo を選択

project-idx-azure-functions-01.png

Repo URL に GitHub の URL を入力

project-idx-azure-functions-02.png

ワークスペース設定中画面

project-idx-azure-functions-03.png

GitHub 拡張を使う

project-idx-azure-functions-04.png

ワンタイムコードを使って GitHub に進む

project-idx-azure-functions-05.png

コードをペーストして継続

project-idx-azure-functions-06.png

許可します

project-idx-azure-functions-07.png

環境の作成が進む

project-idx-azure-functions-08.png

開発環境が作成された状態

project-idx-azure-functions-09.png

.NET と Functions Tools と Azure CLI のバージョン確認

project-idx-azure-functions-10.png

次回以降の開発環境へのアクセスはここから

project-idx-azure-functions-11.png

参考

https://developers.google.com/idx?hl=ja

Discussion