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
280
WPF Digital Ink
grabacr07
0
38k
Modern WPF
grabacr07
0
34k
Other Decks in Technology
See All in Technology
DevIO2025_継続的なサービス開発のための技術的意思決定のポイント / how-to-tech-decision-makaing-devio2025
nologyance
1
380
バイブスに「型」を!Kent Beckに学ぶ、AI時代のテスト駆動開発
amixedcolor
2
540
5年目から始める Vue3 サイト改善 #frontendo
tacck
PRO
3
220
Codeful Serverless / 一人運用でもやり抜く力
_kensh
7
400
Practical Agentic AI in Software Engineering
uzyn
0
100
【初心者向け】ローカルLLMの色々な動かし方まとめ
aratako
7
3.4k
オブザーバビリティが広げる AIOps の世界 / The World of AIOps Expanded by Observability
aoto
PRO
0
360
ブロックテーマ時代における、テーマの CSS について考える Toro_Unit / 2025.09.13 @ Shinshu WordPress Meetup
torounit
0
120
AIのグローバルトレンド2025 #scrummikawa / global ai trend
kyonmm
PRO
1
270
生成AI時代のデータ基盤設計〜ペースレイヤリングで実現する高速開発と持続性〜 / Levtech Meetup_Session_2
sansan_randd
1
150
今!ソフトウェアエンジニアがハードウェアに手を出すには
mackee
12
4.7k
未経験者・初心者に贈る!40分でわかるAndroidアプリ開発の今と大事なポイント
operando
5
390
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1370
200k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
840
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Music & Morning Musume
bryan
46
6.8k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Done Done
chrislema
185
16k
Facilitating Awesome Meetings
lara
55
6.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
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 ライフを!