Silverlight MSBuild任务 - 在Xap复制到ClientBin之后执行命令行 [英] Silverlight MSBuild Task - execute command line after Xap copied to ClientBin

查看:232
本文介绍了Silverlight MSBuild任务 - 在Xap复制到ClientBin之后执行命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个silverlight项目排列如下:

I have a silverlight project arranged as follows:


  • 示例

    • Silverlight

      • Bin


        • 调试


        • {多个子目录}


        • Bin

          • 调试

            • ClientBin

              • Silverlight.Web.xap


                {多子目录}下的代码包含在silverlight DLL中并进行编译,但是我也希望将这些文件作为内容包含在xap文件中。想想用于.NET控件的演示应用程序,它显示了演示,但是还有C#/ xaml代码来实现它。这是我想做的。

                The code under {Multiple Sub Directories} is included in the silverlight DLL and compiled, however I also want to include these files as "Content" in the xap file. Think about demo applications for .NET controls that show you a demo but also the C#/xaml code to achieve it. This is what I'm trying to do.


                • 我无法选择包含为内容,因为它们已作为编译包括

                • 文件两次并编译一个和内容另一个VS2010不会让你。

                我想在输出xap文件中包含Examples / Silverlight / ExampleCode文件夹下的所有文件/文件夹。为了实现这一点,我试图在Silverlight.Web项目的后构建事件。语法如下:

                I would like to include all the files/folders under the Examples/Silverlight/ExampleCode folder in the output xap file. To achieve this I attempted a post-build event on the Silverlight.Web project. The syntax is below:

                "$(SolutionDir)..\Lib\7Zip\7z.exe" a  -tzip 
                    "$(ProjectDir)ClientBin\Silverlight.Web.xap" 
                    "$(SolutionDir)Examples\Silverlight\Bin\Debug\ExampleCode"
                

                现在如果我在控制台窗口中执行这个操作完美。更新xap文件。但是,如果我从Silverlight.Web中的后构建事件执行它没有任何反应(没有失败,只是没有)。

                Now if I execute this in a console window it works perfectly. The xap file is updated. However if I execute it from the post-build event in Silverlight.Web nothing happens (no failure, just nothing).

                我假设在建立xap档案之前启动后建置事件。

                I assume that the post-build event is fired before the xap file is created.

                有没有人知道如何在将 之后将参数复制到ClientBin后运行MSbuild任务或命令行后构建事件?

                Does anyone know how I can run a MSbuild task or command line post-build event with arguments after the xap file is copied to ClientBin?

                推荐答案

                您可以通过将您的文件添加到 XapFilesInputCollection 您的Silverlight项目的 AfterCompile 目标。注意,在Visual Studio中编译时,直接在项目中包含bin文件夹可能会导致访问被拒绝错误。

                You can work around this by adding your files to XapFilesInputCollection in an AfterCompile target of your Silverlight project. Note however that including a bin folder directly in the project may result with an access denied error when compiling in Visual Studio.

                <Target Name="AfterCompile">
                  <ItemGroup>
                    <XapFilesInputCollection Include="$(SolutionDir)Examples\Silverlight\Bin\$(Configuration)\ExampleCode"/>
                  </ItemGroup>
                </Target>
                

                这篇关于Silverlight MSBuild任务 - 在Xap复制到ClientBin之后执行命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆