Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
みんな大好き Boo.Lang を SATSUGAI する方法
Search
Grabacr07
February 24, 2015
Technology
1
46k
みんな大好き Boo.Lang を SATSUGAI する方法
Visual Studio Tools for Unity 勉強会での LT 資料です。
VSTU の機能で、.sln / .csproj の生成処理にフックする方法について。
Grabacr07
February 24, 2015
Tweet
Share
More Decks by Grabacr07
See All by Grabacr07
Step up WPF
grabacr07
0
73k
デスクトップ アプリがこの先生きのこるには (2016)
grabacr07
2
88k
Windows 10 で遊ぶ Virtual Desktop
grabacr07
0
91k
Roslyn + KanColleViewer
grabacr07
0
1.2k
WPF 4.6
grabacr07
1
60k
UniRx とか Reactive Property とか
grabacr07
12
69k
Road to UI Library
grabacr07
0
260
WPF Digital Ink
grabacr07
0
38k
Modern WPF
grabacr07
0
34k
Other Decks in Technology
See All in Technology
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
8
65k
TypeScript と歩む OpenAPI の discriminator / OpenAPI discriminator with TypeScript
kaminashi
1
150
OTel meets Wasm: プラグイン機構としてのWebAssemblyから見る次世代のObservability
lycorptech_jp
PRO
1
300
MCP Clientを活用するための設計と実装上の工夫
yudai00
1
790
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
4
1.5k
セキュリティSaaS企業が実践するCursor運用ルールと知見 / How a Security SaaS Company Runs Cursor: Rules & Insights
tetsuzawa
0
320
継続戦闘能⼒
sansantech
PRO
0
220
令和最新版TypeScriptでのnpmパッケージ開発
lycorptech_jp
PRO
0
110
JNation 2025 - Quarkus for Spring Developers
edeandrea
PRO
0
110
やさしいClaude Code入門
minorun365
PRO
31
23k
大規模PaaSにおける監視基盤の構築と効率化の道のり
lycorptech_jp
PRO
0
180
会社員しながら本を書いてきた知見の共有
sat
PRO
3
690
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
19
1.2k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Agile that works and the tools we love
rasmusluckow
329
21k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Practical Orchestrator
shlominoach
188
11k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
25
2.8k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
Automating Front-end Workflow
addyosmani
1370
200k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.6k
The Language of Interfaces
destraynor
158
25k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
1
79
Transcript
Boo.Langを SATSUGAI する方法 2015/02/24 VSTU 勉強会 Manato KAMEYA (@Grabacr07) みんな大好き
Self Introduction Work 亀谷学人 - 株式会社グラニ C# + Unity でソーシャルゲーム開発
Private Microsoft MVP for .NET (Visual C#) Room metro Tokyo staff (Windows クライアント開発 勉強会) Twitter: @Grabacr07 Facebook: manao.kameya Blog: http://grabacr.net/ 最先端の C# をフルに活用 CTO: @neuecc (UniRx 開発者)
C# Everywhere Windows Desktop WinForms, WPF Windows 8 Windows Universal
apps Mac application Xamarin.Mac Web application ASP .NET MVC, ASP .NET Web API Game Unity, Playstation Mobile SDK Mobile (iOS, Android, WP) MonoTouch, Mono for Android Embedded, IoT .NET Framework Embedded Cloud Windows Azure, AWS
Boo.Lang の襲来 Visual Studio の補完機能 電球アイコンをクリック (もしくは Ctrl + .
(dot) でも出るよ!) 例: using System.Linq; が必要、なので書いてくれる
Boo.Lang の襲来 Visual Studio の補完機能 “List” と入力して補完すると…?
Boo.Lang の襲来 Visual Studio の補完機能 “List” と入力して補完すると…? 本当に必要なのは System.Collections.Generic の方
Boo.Lang が真っ先に出てくる ので、Ctrl + . (dot) -> Enter と高速で 入力すると Boo.Lang.List になってしまう
Visual Studio Tools for Unity に対する不満 Boo.Lang.dll への参照 ぶっちゃけ必要ない! が、VSTU
が自動的に追加 (Visual Studio で削除してもムダ) VSTU が生成した .sln or .csproj に不満がある なら加工しましょう!
Project File Generation VSTU の生成処理をフックする SyntaxTree.VisualStudio.Unity.Bridge.dll VSTU をインポートすると自動的に参照 (Editor project)
デバッグ実行可能 もちろん、ブレークポイントで止められます!
Project File Generation ProjectFilesGenerator class ProjectFileGeneration - 生成された .csproj に対するフック
SolutionFileGeneration - 生成された .sln に対するフック ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) => { // 中略 // 煮るなり焼くなりお好きに return result; };
Project File Generation ProjectFilesGenerator class ProjectFileGeneration - 生成された .csproj に対するフック
SolutionFileGeneration - 生成された .sln に対するフック ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) => { // 中略 // 煮るなり焼くなりお好きに return result; }; 対象ファイル名 例: "UnityVS.SampleProject1.CSharp.Editor.csproj" 生成されたファイルの中身 .csproj の場合は XML がずらずらと… 好きに加工して、文字列で返す
Boo.Lang への参照を削除 LINQ to XML を使う 本題から外れるので特に解説はしません :) static string
KillBooLang(string filename, string content) { var document = XDocument.Parse(content); document.Root .Descendants() .Where(x => x.Name.LocalName == "Reference") .Where(x => (string)x.Attribute("Include") == "Boo.Lang") .Remove(); return document.Declaration + Environment.NewLine + document.Root; }
Boo.Lang への参照を削除 LINQ to XML を使う 本題から外れるので特に解説はしません :) static string
KillBooLang(string filename, string content) { var document = XDocument.Parse(content); document.Root .Descendants() .Where(x => x.Name.LocalName == "Reference") .Where(x => (string)x.Attribute("Include") == "Boo.Lang") .Remove(); return document.Declaration + Environment.NewLine + document.Root; } … <ItemGroup> <Reference Include="mscorlib" /> <Reference Include="System" /> <Reference Include="System.XML" /> <Reference Include="System.Core" /> <Reference Include="Boo.Lang" /> <Reference Include="UnityScript.Lang" /> <Reference Include="UnityEngine"> … 要は、この行を削除 すればいいのです
Notice イベントを購読しているように見える 特に公式サンプルが… http://unityvs.com/documentation/api/project-file-generation/ Project(Solution)FileGeneration はただのデリゲート (まあ文字列返してる時点で気付けという話ではあるけども) 例えば次の場合 ProjectFilesGenerator.ProjectFileGeneration +=
Hook1; ProjectFilesGenerator.ProjectFileGeneration += Hook2; ProjectFilesGenerator.ProjectFileGeneration += Hook3; ProjectFilesGenerator.ProjectFileGeneration += Hook4;
Notice イベントを購読しているように見える 特に公式サンプルが… http://unityvs.com/documentation/api/project-file-generation/ Project(Solution)FileGeneration はただのデリゲート (まあ文字列返してる時点で気付けという話ではあるけども) 例えば次の場合 ProjectFilesGenerator.ProjectFileGeneration +=
Hook1; ProjectFilesGenerator.ProjectFileGeneration += Hook2; ProjectFilesGenerator.ProjectFileGeneration += Hook3; ProjectFilesGenerator.ProjectFileGeneration += Hook4; 有効なのは最後の 1 回だけ それ以前の 3 回は、呼び出されはする ものの、結果は無視される
Conclusion Project File Generation VSTU による .csproj / .sln 生成処理はフックできる
LINQ to XML で XML を加工して返してあげよう 例として Boo.Lang への参照を削除してみた T4 Template (.tt file) を取り込んだり、#define 定義したり? 快適な C# + Visual Studio ライフを!