将Xaml编译成Baml?
如何将 xaml 转换为 baml?
谢谢
How can I convert a xaml to baml?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何将 xaml 转换为 baml?
谢谢
How can I convert a xaml to baml?
thanks
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
您可以通过创建引用 XAML 的 MSBuild 项目文件来编译该 XAML。 这就是当您对项目进行编译时 Visual Studio“幕后”发生的情况(它创建一个临时 .proj 文件并生成它)。
一个相当小的项目文件 (xamlcompile.csproj) 是这样的:
然后您可以通过运行以下命令生成 BAML 文件:
这将在 obj\Debug 下创建一个 baml 文件,在上面的示例中它将是 obj\Debug\主题\Generic.baml。
希望有帮助。
You can compile the XAML by creating an MSBuild project file that references it. This is what happens in Visual Studio "under the covers" when you do a compile on your project (it creates a temporary .proj file and builds it).
A fairly minimal project file (xamlcompile.csproj) is something like this:
And you can then generate the BAML file by running the command:
This will create a baml file under obj\Debug, in the example above it will be obj\Debug\Themes\Generic.baml.
Hope that helps.
有一个 Reflector 插件可以加载包含 BAML 资源的程序集(例如本地化资源程序集)并显示相应的 XAML: BamlViewer
在 Visual Studio 中编译 WPF 应用程序时,所有 XAML 文件都会转换为 BAML,然后该 BAML 作为资源嵌入到最终的 DLL 或 EXE 程序集中。
There is a Reflector plug-in that loads assemblies containing BAML resources (e.g. localized resource assemblies) and shows the corresponding XAML: BamlViewer
When you compile a WPF application in Visual Studio, all your XAML files are converted into BAML, and that BAML is then embedded as a resource into the final DLL or EXE assembly.