WPF 应用程序在 vs2k8 中构建,但不在命令行上使用 msbuild

2024-04-19

我有一个相当小的解决方案,其中包含 WPF Windows 应用程序。当从解决方案构建时,它构建得非常好。我最近将解决方案中包含的项目集成到使用 MSBuild 的现有的、更大的命令行构建中。但是,当从命令行构建时,我收到以下错误:

MainWindow.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\EngineMonitorView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\HostingEngineView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\MainView.xaml.cs(13,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\MainView.xaml.cs(17,52): error CS0103: The name 'gView' does not exist in the current context
View\PerformanceCounterView.xaml.cs(22,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\PerformanceCounterView.xaml.cs(117,22): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(118,20): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(127,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(138,5): error CS0103: The name 'txtScale' does not exist in the current context
View\PerformanceCounterView.xaml.cs(179,5): error CS0103: The name 'txtLast' does not exist in the current context
View\PerformanceCounterView.xaml.cs(180,5): error CS0103: The name 'txtMin' does not exist in the current context
View\PerformanceCounterView.xaml.cs(181,5): error CS0103: The name 'txtMax' does not exist in the current context
View\PerformanceCounterView.xaml.cs(189,5): error CS0103: The name 'txtAverage' does not exist in the current context
View\PerformanceCounterView.xaml.cs(250,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(251,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(253,27): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(255,27): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(264,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(269,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(274,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(279,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(293,5): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(303,5): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(318,5): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(325,5): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(342,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\ServerMonitorView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\ServerTreeView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\ServiceDetailView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\ServiceMonitorView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context

我将 .NET 3.5 中的 WinFX 目标文件包含在我们的根 MSBuild .proj 文件中,因为它似乎没有包含在其他任何地方:

<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" />

但这似乎没有影响任何事情,而且我仍然遇到错误。据我所知,将 .xaml 文件预编译为 .cs 文件、嵌入和连接资源等的自定义 WPF 构建任务似乎没有运行,这就是为什么 InitializeComponent 和我的视图中定义的任何控件都是未找到。我不知所措why不过,尝试浏览无数与 WPF 和 MSBuild 相关的搜索结果并没有给我带来任何帮助。

UPDATE:

将 Microsoft.WinFX.targets 添加到 .csproj 文件似乎可以工作。然而,这样做会导致项目无法在 Visual Studio 2008 中构建。不知何故,VS 为您包含了这些目标......但我不确定如何实现。有谁更了解VS如何构建WPF项目?是否有一个主构建文件隐藏在导入适当目标的地方?


向 msbuild 发送您的解决方案文件而不是 .csproj 文件有时会有所帮助:

msbuild.exe yoursolution.sln

此外,devenv.exe 本身提供了一个命令行构建,应该与 IDE 中的体验相同:

devenv.exe /build yoursolution.sln
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

WPF 应用程序在 vs2k8 中构建,但不在命令行上使用 msbuild 的相关文章

随机推荐

  • 我们可以在 PHP 的任何函数中传递数组作为参数吗?

    我有一个向用户发送邮件的函数 我想将其参数之一作为 id 数组传递 这可以吗 如果是的话 该怎么办 假设我们有一个函数 function sendemail id userid 在示例中 id应该是一个数组 您可以传递一个数组作为参数 它是
  • 类型参数 T 使用 Eclipse 将类型 T 隐藏在 T[] toArray(T[] a) 中

    将 eclipse 4 2 与 Java 7 一起使用并尝试实现 List 接口的以下方法时 我收到了警告 public
  • 访问 sails.js 的基础 http 服务器

    您好 有没有办法访问 sails 的基本 http 服务器上下文 我想在我的应用程序中使用binaryJS 并且在 gettig 入门指南中 他们正在谈论自己创建服务器 如果您有一个现有的 Express 应用程序 其中包含以下行 var
  • 如何加快这段 Java 代码的速度?

    我正在尝试测试 Java 执行一项简单任务的速度有多快 将一个大文件读入内存 然后对数据执行一些无意义的计算 所有类型的优化都很重要 无论是以不同的方式重写代码还是使用不同的 JVM 欺骗 JIT 输入文件是一个由逗号分隔的 5 亿长的 3
  • 为什么 $count=true 的 OData 查询返回一个对象?

    我试图弄清楚如何正确支持返回 OData API 中 已过滤的 数据集中的项目数 我的理解是添加 count true查询字符串的参数应该允许这样做 现在 基于官方文档中教程的示例 https www odata org getting s
  • SQL 2008 存储过程中的可选 where 子句/参数?

    我正在编写一些更新表的代码 根据用户想要执行的操作 它会更新一大组记录或较小的记录 描述因素是组ID 用户可以选择是更新表中的所有记录 还是仅更新具有该 groupID 的记录 我想对两个实例使用相同的存储过程 其中可能有一些逻辑来区分场景
  • JQuery html() 与 innerHTML

    我可以完全依赖 jQuery 吗html 方法的行为与innerHTML 有什么区别吗innerHTML和 jQuery 的html 方法 如果这些方法都做同样的事情 我可以使用 jQuery 的吗 html 方法代替innerHTML 我
  • 获取 Firefox 中扩展的附加 ID

    我想在浏览器选项卡中打开扩展作为普通的 html 页面 以便我可以使用 selenium WebDriver 自动化它 在 Firefox 中 可以使用这样的链接来完成 moz extension f1b30486 cd88 4319 bb
  • 在生产模式下写入全局变量有什么问题?

    我看了一下连接mongodb的示例代码 看到了一句看不懂的内容 为什么在开发的情况下使用全局变量是安全的 又为何没有投入生产 您不需要理解代码 请只看评论部分 import MongoClient from mongodb let clie
  • 为什么主要编译器对 stdint.h 使用 typedef 而对 stdbool.h 使用 #define?

    我刚刚注意到 gcc 和 clang 似乎都对 stdint h 使用 typedef 但对 stdbool h 使用 define 例子 clang 的 stdint h https clang llvm org doxygen stdi
  • 应用程序中有多少个并发线程才算是很多?

    5 100 1000 我想 这取决于 但是取决于什么呢 作为服务器守护进程 服务运行的应用程序有什么常见之处 什么是硬限制 鉴于机器可以处理总体工作负载 我如何确定开销在多少个线程时开始对性能产生影响 操作系统之间的重要区别是什么 还应该考
  • 从 Windows 任务列表返回命令行

    我正在寻找一个命令来获取在 Windows 任务管理器中写入的命令行 我正在使用tasklist fo CSV v但它不提供我查看任务管理器时得到的命令行 我附上一张图片来说明我的意思 它是最右边的一列 我在系统调用中需要这些信息r 只是为
  • 如何在eclipse中配置ADT插件

    开发者网站上有以下说明 配置 ADT 插件 一旦 Eclipse 重新启动 您必须指定 Android SDK 目录的位置 在出现的 欢迎使用Android开发 窗口中 选择 使用现有的SDK 浏览并选择您最近下载并解压的 Android
  • 限制多处理python中的进程数量

    我的要求是生成hundreds of HTTP POST requests per second 我正在使用它urllib2 def send req urllib2 Request url req add data data respon
  • 尝试添加已经有父级错误的 SKNode

    我在尝试运行我的游戏时收到错误 尝试添加已有父节点的 SKNode 如果我将 SKSpriteNode 在本地添加到函数中 它就可以正常运行 但是当我尝试在全球范围内声明它时 我收到了该错误 任何解决此错误的帮助都会很棒 我认为这与self
  • 对具有不同服务参数的多个实体使用相同的实体侦听器

    由于 EntityListener 注册为服务 是否可以使用不同的参数多次注册同一个类 并将它们每个与特定的实体相关联 考虑以下实体 Class EntityA ORM Entity ORM EntityListeners myBundle
  • 某些团队服务菜单项上的星号是什么?

    当我在浏览器中访问我的 Team Services 帐户时 某些菜单项的名称末尾有一个星号 在此图中 您可以看到其中的 2 个示例 Wiki 和 工作项 那个星号是什么意思 这是一个预览功能 您可以从预览功能菜单中打开 关闭 更多信息 使用
  • 如何将 Jira 问题收集器与 Angular 应用程序集成?

    我正在创建一个 Angular 7 应用程序 它利用 Jira 问题收集器将问题直接提交到各自的项目 当我按照现在的方式构建应用程序时 什么也没有发生 当我直接将代码从方法 submitIssue 移动到 ngOnInIt 下时 会出现问题
  • Scala:对象初始值设定项中的并行集合导致程序挂起

    我刚刚注意到一种令人不安的行为 假设我有一个由单个对象组成的独立程序 object ParCollectionInInitializerTest def doSomething println Doing something for i l
  • WPF 应用程序在 vs2k8 中构建,但不在命令行上使用 msbuild

    我有一个相当小的解决方案 其中包含 WPF Windows 应用程序 当从解决方案构建时 它构建得非常好 我最近将解决方案中包含的项目集成到使用 MSBuild 的现有的 更大的命令行构建中 但是 当从命令行构建时 我收到以下错误 Main