title | description |
---|---|
拡張機能用のC#プロジェクトを作成 |
Beutl拡張機能用に空のC#プロジェクトを作成する方法を説明します。 |
Beutl拡張機能用に空のC#プロジェクトを作成する方法を説明します。
この記事では、Visual Studio Code、Visual Studio を使う方法を紹介します。
また、対象とするBeutlのバージョンは1.0.0-preview.6
とします。
- ターミナルを使用して、クラスライブラリを作成します。
dotnet new classlib -o MyBeutlExtension
ディレクトリ構造が以下のようになることをご確認ください。
MyBeutlExtension
┣━ obj
┃ ┗━ (...)
┣━ Class1.cs
┗━ MyBeutlExtension.csproj
- 生成された
MyBeutlExtension.csproj
を以下のように編集します。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- TargetFrameworkはBeutlのバージョンに応じて変更してください -->
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- 以下は任意です。 -->
<RepositoryUrl>url/to/repository</RepositoryUrl>
<PackageId>MyBeutlExtension</PackageId>
<Title>拡張機能のサンプル</Title>
<Description>サンプル</Description>
<PackageTags>sample</PackageTags>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Authors>作者名</Authors>
</PropertyGroup>
<!-- ビルドしたときに、サイドロード拡張機能として認識されるようにする。 -->
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<EnableDynamicLoading>true</EnableDynamicLoading>
<OutputPath>$([System.Environment]::GetFolderPath(SpecialFolder.UserProfile))\.beutl\sideloads\$(AssemblyName)</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Beutl.Extensibility" Version="1.0.0-preview.6" />
<PackageReference Include="Beutl.ProjectSystem" Version="1.0.0-preview.6" />
<PackageReference Include="Beutl.Operators" Version="1.0.0-preview.6" />
</ItemGroup>
</Project>
- 以下のコマンドを実行して、
nuget.config
を生成し、パッケージソースを追加します。
dotnet new nugetconfig
dotnet nuget add source "https://nuget.beditor.net/v3/index.json" --name nuget.beditor.net
以上で拡張機能用に空のC#プロジェクトを作成することができました。
-
フレームワークはBeutlのバージョンに応じて選択してください。
-
作成をクリックします。
ディレクトリ構造が以下のようになることをご確認ください。
MyBeutlExtension
┣━ MyBeutlExtension
┃ ┣━ obj
┃ ┃ ┗━ (...)
┃ ┣━ Class1.cs
┃ ┗━ MyBeutlExtension.csproj
┗━ MyBeutlExtension.sln
- 生成された
MyBeutlExtension.csproj
を以下のように編集します。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- TargetFrameworkはBeutlのバージョンに応じて変更してください -->
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- 以下は任意です。 -->
<RepositoryUrl>url/to/repository</RepositoryUrl>
<PackageId>MyBeutlExtension</PackageId>
<Title>拡張機能のサンプル</Title>
<Description>サンプル</Description>
<PackageTags>sample</PackageTags>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Authors>作者名</Authors>
</PropertyGroup>
<!-- ビルドしたときに、サイドロード拡張機能として認識されるようにする。 -->
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<EnableDynamicLoading>true</EnableDynamicLoading>
<OutputPath>$([System.Environment]::GetFolderPath(SpecialFolder.UserProfile))\.beutl\sideloads\$(AssemblyName)</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Beutl.Extensibility" Version="1.0.0-preview.6" />
<PackageReference Include="Beutl.ProjectSystem" Version="1.0.0-preview.6" />
<PackageReference Include="Beutl.Operators" Version="1.0.0-preview.6" />
</ItemGroup>
</Project>
- 以下のコマンドを実行して、
nuget.config
を生成し、パッケージソースを追加します。
dotnet new nugetconfig
dotnet nuget add source "https://nuget.beditor.net/v3/index.json" --name nuget.beditor.net
以上で拡張機能用に空のC#プロジェクトを作成することができました。