【发布时间】:2011-11-06 14:12:40
【问题描述】:
有没有办法在模拟器中使用命令行打开 Windows Phone 7 应用程序?
我知道已经存在与此here 相关的问题,但我想要一种简单的方法来从命令行启动 wp7 应用程序(具有 xap 文件),而无需修改应用程序的代码。
我知道这对于 XNA 应用程序是可能的(信息 here)但我不知道这对于在 Silverlight 框架下制作的应用程序是否可能?!
稍后编辑 - 问题已解决
仔细看,贾斯汀的博客似乎对我遇到的这个问题非常好。 无论如何,我不得不做一些小改动: 换行:
Platform WP7SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "New Windows Mobile 7 SDK");
进入行:
Platform WP7SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "Windows Phone 7");
我使用foreach 来检索平台名称:
// iterate over all platforms and write their names
foreach (Platform p in dsmgrObj.GetPlatforms().ToList<Platform>())
{
Console.WriteLine("Platform: " + p.Name);
}
还有一行:
WP7Device = WP7SDK.GetDevices().Single(d => d.Name == "Windows Phone 7 Emulator");
进入行:
WP7Device = WP7SDK.GetDevices().Single(d => d.Name == "Windows Phone Emulator");
再次使用foreach:
// iterate over all devces and write their names
foreach (Device d in WP7SDK.GetDevices().ToList<Device>())
{
Console.WriteLine("Device: " + d.Name);
}
【问题讨论】:
-
您能否澄清 Jeff Wilcox 对您所链接的 Scott 问题的回答如何没有回答您自己的问题?
-
@Rowland Shaw:我不想在代码中添加一些东西......我只有 xap 文件,我想知道是否可以使用某些命令行运行它。明天我将深入研究 Justin Angel 的博文。谢谢。
-
Justin 的博客文章详细介绍了如何在不更改 XAP 本身的情况下将该应用程序放到模拟器上
-
这是我的第一个问题:如何创建“控制台应用程序”?我没有控制台应用程序模板...我已经安装了 Windows Phone SDK 7.1 RC
-
@Rowland Shaw:仔细看,贾斯汀的博客文章似乎非常适合我的情况。谢谢!