3
2

More than 5 years have passed since last update.

VSCodeでBuild.cs(UnrealBuildTool)のIntelliSenseを行うメモ

Posted at

UnrealEngine4のビルド構成等を設定を行なうBuild.cs, Target.csでVisualStudioからIntelliSenseが効かなくて困ったので
VSCode(OmniSharp)を使ってIntelliSenseを扱う方法のメモ

VSCodeインストール

VSCode
↑のリンクから自分の扱うOSにあったものをインストールする

C#の拡張機能をインストール

C#
image

拡張機能タブからC#を検索してインストールを行ってください

プロジェクトファイルを配置

ソースフォルダの直下に↓のファイルを配置

UeBuild.sln

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UeBuild", "UeBuild.csproj", "{52859B8C-ACE3-48C8-954E-0D8CFAF7DA5C}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {52859B8C-ACE3-48C8-954E-0D8CFAF7DA5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {52859B8C-ACE3-48C8-954E-0D8CFAF7DA5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {52859B8C-ACE3-48C8-954E-0D8CFAF7DA5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {52859B8C-ACE3-48C8-954E-0D8CFAF7DA5C}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal
UeBuild.csproj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{52859B8C-ACE3-48C8-954E-0D8CFAF7DA5C}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>UeBuild</RootNamespace>
    <AssemblyName>UeBuild</AssemblyName>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <OutputPath>bin\Debug\</OutputPath>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
    <Reference Include="UnrealBuildTool">
      <!--自分のUnrealBuildToolへのパス-->
      <HintPath>C:\Program Files (x86)\Epic Games\4.13\Engine\Binaries\DotNET\UnrealBuildTool.exe</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="*.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

csprojはワイルドカードに対応している為、下記のように"*.cs"と記載するとすべての.csファイルが認識されます

  </ItemGroup>
  <ItemGroup>
    <Compile Include="*.cs" />
  </ItemGroup>

プロジェクトの設定

  1. コマンドパッドに"> Omnisharp: Select Project"と入力 image
  2. 先程配置したslnを選択 image
  3. IntelliSenseが効くようになる image
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2