none
Output .baml / Custom build parameters?

    Question

  • I am using C# and XAML in Visual Studio Community 2017 v15.5.6. I would like to output .baml files for the XAML compilations. I read that if I were building from the command line, I could add /target:ResolveReferences;MarkupCompilePass1;MarkupCompilePass2 to the MSBuild.exe line. However, I can't seem to find a place to insert this text. Are there checkboxes hiding somewhere, or have I just missed the place where I can add custom text to the build parameters? If so, where is it?

    What I really wish I could do is see the C# that is built from the XAML (for learning purposes), but from what I understand XAML is never converted into C# in the process of compiling it into IL.

    Tuesday, March 6, 2018 2:52 PM

Answers

  • @GregJ7, AFAIK, there is no such place to set the parameter for the MSBuild statement on UI of Visual Studio IDE. But you can specify those targets in the project file .csproj(Unload the project, edit it). In second line of the .csproj file, you can find following code snippet:

    <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    You can add the your specify targets in the DefaultTargets, in this settings, MSBuild/VS will execute those targets. Of course, you can add them into the InitialTargets,DependsOnTargets, it`s all depends on the target build order of those targets.

    See Target Build Order for some details.

    Hope this helps.


    MSDN Community Support Please remember to click Mark as Answer. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, March 9, 2018 3:07 AM

All replies

  • Hi friend,

    Thanks for your posting.

    >>However, I can't seem to find a place to insert this text. Are there checkboxes hiding somewhere, or have I just missed the place where I can add custom text to the build parameters? If so, where is it?

    As I know, there is no such checkbox in Visual Studio.

    >>What I really wish I could do is see the C# that is built from the XAML (for learning purposes), but from what I understand XAML is never converted into C# in the process of compiling it into IL.

    I don't think XAML could be into C#, it could be compiled into BAML: http://blogs.microsoft.co.il/tomershamam/2007/05/25/compiled-xaml-baml-not-il/

    and XAML can be optionally compiled directly into intermediate language (IL) with the XAML compiler (XAMLC):

    https://developer.xamarin.com/guides/xamarin-forms/xaml/xamlc/

     

    Regards,

    Fletcher

     


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, March 7, 2018 7:43 AM
  • Thanks for your reply. Regarding, "...I could add /target:ResolveReferences;MarkupCompilePass1;MarkupCompilePass2 to the build parameters,

    where can I add this switch to the build operation?

    >>I don't think XAML could be into C#, it could be compiled into BAML: http://blogs.microsoft.co.il/tomershamam/2007/05/25/compiled-xaml-baml-not-il/

    Unfortunately, this fellow doesn't explain how to do it. How do I get a BAML file from a XAML file?
    Wednesday, March 7, 2018 12:50 PM
  • Are you using MSBuild?

    Actually this forum is for Visual Studio IDE issue, for XAML issue WPF forum might be a more proper place.

     

    Regards,

    Fletcher  


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, March 8, 2018 6:07 AM
  • I am asking about where a feature can be found in the IDE. The parameter for the MSBuild statement I gave is only to explain what it is I want to do in the IDE.
    Thursday, March 8, 2018 1:21 PM
  • @GregJ7, AFAIK, there is no such place to set the parameter for the MSBuild statement on UI of Visual Studio IDE. But you can specify those targets in the project file .csproj(Unload the project, edit it). In second line of the .csproj file, you can find following code snippet:

    <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    You can add the your specify targets in the DefaultTargets, in this settings, MSBuild/VS will execute those targets. Of course, you can add them into the InitialTargets,DependsOnTargets, it`s all depends on the target build order of those targets.

    See Target Build Order for some details.

    Hope this helps.


    MSDN Community Support Please remember to click Mark as Answer. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, March 9, 2018 3:07 AM