将团队构建输出文件夹中的文件包含到XAP中 [英] Include files from Team build output folder into XAP
问题描述
我正在尝试使用TFS 2010进行Windows Phone 7.1项目的持续集成. 有2个资源项目( Win32本地化项目)和Windows Phone主项目.
I'm trying to do Continuous Integration using TFS 2010 for a Windows Phone 7.1 project. There are 2 resource projects (Win32 Project for localisation) and the main Windows phone project.
我已将以上2个项目的项目输出复制到主WP项目中的文件夹中("MUI"文件夹中),并在构建操作中将文件标记为内容". 在Visual Studio 2010中构建和运行WP7项目时,所有方法都可以很好地工作.
I have copied the project output of above 2 projects to a folder in the main WP project (inside 'MUI' folder) , and also marked the files as 'content' in build action. All works well when building and running the WP7 project from Visual Studio 2010.
但是,当我尝试使用TFS 2010构建系统构建项目时, 构建失败,并显示以下错误"Xap包装失败.对象引用未设置为对象的实例" .在研究了错误之后,我发现在TFS代理计算机上构建文件时,TFS二进制文件(输出文件夹)文件夹没有"MUI"文件夹,但是2个资源项目的输出直接复制到了二进制文件中文件夹,从而导致构建失败.
But when I try to build the projects using TFS 2010 build system , the build fails with the following error "Xap packaging failed. Object reference not set to an instance of an object" . After researching about the error, i found that when files are build on the TFS agent machine, the TFS binaries(output folder) folder doesn't have an "MUI" folder but the output of the 2 resources projects get directly copied into the binaries folder, and hence failing the build.
我还注意到,如果我直接将文件添加/包括到主WP项目中,则TFS构建成功.(换句话说,如果我将项目输出配置为复制,则TFS构建失败 到WP7项目文件夹.由于TFS会将所有内容都构建到"binaries"文件夹中)
Also i have noticed that if i add/include the files directly to the main WP project, the TFS build succeeds.(in other words fails if i configure project output to copy to WP7 project folder. Since TFS builds everything to 'binaries' folder)
如何从TFS二进制文件文件夹中将这些文件包含在WP7 XAP文件中(引用它们)? (使用MSBuild任务?),并且该方法也可以在本地使用 在VS2010中也可以构建.
How can I include those files within the WP7 XAP file (referring them) from the TFS binaries folder? (using MSBuild task? ) and the same should work with local builds within VS2010 also.
还有其他方法可以做到这一点吗?
Also are there other ways to do this?
thx
推荐答案
这就是我使用 位置
- 本地
- 构建服务器(TFS 2012)
Visual Studio版本
- Visual Studio 2010
- Visual Studio 2012
Silverlight版本
- Silverlight 4
- 使用SlowCheetah创建转换
-
在项目结尾使用以下信息更新Visual Studio项目:
- Use SlowCheetah to create the transformations
Update the Visual Studio project with the following information at the end of the project:
<PropertyGroup>
<XapPackagerDependsOn>
TransformAllFiles;
IncludeTransformedFileInXapFile;
$(XapPackagerDependsOn);
</XapPackagerDependsOn>
</PropertyGroup>
<Target Name="IncludeTransformedFileInXapFile">
<ItemGroup>
<XapFilesInputCollection Include="$(OutDir)YOUR-FILES.CONFIG" />
</ItemGroup>
</Target>
-
确保未将配置文件和转换文件复制到输出文件夹中:
Make sure the config files and the transformation files do not get copied to the output folder:
这篇关于将团队构建输出文件夹中的文件包含到XAP中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!