- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在这里查看了其他几个与 SGen 相关的问题,要么他们的答案不适用,要么他们的答案不能为我解决这个问题。我已经安装了几个 SDK 来解决这个问题,但没有运气。不应更改引用类型,因为这是唯一有问题的地方。曾经的建议是将 SGen.exe 放入 C:\Windows\Microsoft.NET\Framework\v3.5
文件夹,但这不是在盒子上完成的,这不是问题。在这种情况下,SGen.exe
实际上存在并且就在它应该在的地方,但是由于某种原因,MSBuild 仍然无法找到它!
背景:
我们有一个 NAnt 脚本可以自动化我们的构建。在这种情况下,NAnt 正在调用 MSBuild,而 MSBuild 正在生成声称无法找到 SGen 的错误。该项目基于 .NET 3.5。我有我的主要开发环境(64 位 Vista Ultimate),脚本在其中完美运行,我试图在 VM(64 位 Win 7 Ultimate)中复制它。我认为我已经拥有一切,我应该可以顺利进行,但是这在 Win7 机器上失败了(在 Vista 机器上完美运行)。
我对这两个盒子做了一些比较,它们在这方面看起来都一样,但仍然失败。例如,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
的 sdkInstallRootv2.0
值设置为 C:\Program Files\Microsoft.NET\SDK\v2.0 64bit\
在两台机器上。在两台机器中,SGen.exe
位于该路径的 bin
子目录。
南特脚本:
<target name="report-installer" depends="fail-if-environment-not-set">
<exec program="MSBuild.exe" basedir="${framework35.directory}">
<arg value="${tools.directory.current}\ReportInstaller\ReportInstaller.sln" />
<arg value="/p:Configuration=${buildconfiguration.current}" />
</exec>
</target>
report-installer:
[exec] Microsoft (R) Build Engine Version 3.5.30729.4926
[exec] [Microsoft .NET Framework, Version 2.0.50727.4927]
[exec] Copyright (C) Microsoft Corporation 2007. All rights reserved.
[exec]
[exec] Build started 4/8/2010 11:28:23 AM.
[exec] Project "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.sln" on node 0 (default targets).
[exec] Building solution configuration "Release|Any CPU".
[exec] Project "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.sln" (1) is building "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.csproj" (2) on node 0 (default targets).
[exec] Could not locate the .NET Framework SDK. The task is looking for the path to the .NET Framework SDK at the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework SDK. 2.) Manually set the above registry key to the correct location.
[exec] CoreCompile:
[exec] Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
[exec] C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1902,9): error MSB3091: Task failed because "sgen.exe" was not found, or the .NET Framework SDK v2.0 is not installed. The task is looking for "sgen.exe" in the "bin" subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework SDK v2.0. 2.) Manually set the above registry key to the correct location. 3.) Pass the correct location into the "ToolPath" parameter of the task.
[exec] Done Building Project "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.csproj" (default targets) -- FAILED.
[exec] Done Building Project "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.sln" (default targets) -- FAILED.
[exec]
[exec] Build FAILED.
[exec]
[exec] "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.sln" (default target) (1) ->
[exec] "C:\Projects\Production\Tools\ReportInstaller\ReportInstaller.csproj" (default target) (2) ->
[exec] (GenerateSerializationAssemblies target) ->
[exec] C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1902,9): error MSB3091: Task failed because "sgen.exe" was not found, or the .NET Framework SDK v2.0 is not installed. The task is looking for "sgen.exe" in the "bin" subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework SDK v2.0. 2.) Manually set the above registry key to the correct location. 3.) Pass the correct location into the "ToolPath" parameter of the task.
[exec]
[exec] 0 Warning(s)
[exec] 1 Error(s)
[exec]
[exec] Time Elapsed 00:00:00.24
[call] C:\Projects\Production\Source\reports.build(15,4):
[call] External Program Failed: C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe (return code was 1)
最佳答案
这似乎是我最近自己遇到的一个常见问题。
在“构建”选项卡上的项目属性中,将选项“ 生成序列化程序集”从“自动”设置为“ 关闭”。
更新
如果您还没有尝试过,请确保 <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
为发布和调试配置设置。
关于.net - 编译解决方案时MSBuild找不到SGen,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2601911/
我正在尝试做一些不寻常的事情...... 我有这个类 Foo : public class Foo { public Foo(string name) { this.N
操作系统:Ubuntu 是否可以将单一服务与 sgen 垃圾收集器一起使用?普通的垃圾收集器会泄露我所有的内存,直到世界末日到来。如果我找不到让 sgen 与单一服务一起工作的方法,我可能只能改用 c
更改 visual studio 项目的输出目录后,它开始无法构建并出现错误,非常类似于: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bi
我已经实现了 Generating an Xml Serialization assembly as part of my build 接受的答案中提到的更改
我在使用 MSBuild 时收到以下错误。我得到的错误是: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets
Java7的G1垃圾收集器和mono的SGen垃圾收集器的主要区别是什么?我知道它们都是分代 GC,但它们在性能和架构方面有何不同? 最佳答案 首先,让我们回顾一下两个 GC 收集器: Mono 的
我在以下环境中开发了一个应用程序(在我的错误中重命名为 MyApplication 以保护隐私): 单点触控 2.1 MonoDevelop 2.4.2 MacOS 10.6.8 iOS SDK 4.
在 Windows 10 上运行 VS 2017 15.5.3。 收到此一般性错误“无法运行指定的任务可执行文件“sgen.exe”。文件名或扩展名太长”在发布配置和 X64 平台中构建项目时。但它在
尝试在 Visual Studio 2008 专业版中构建我的项目时出现以下错误: Task failed because “sgen.exe” was not found, or the corre
在我的 Visual Studio 2010 项目中,我使用以下 Post-Build 事件命令行使用 sgen 创建 XmlSerializers.dll。 构建后事件: "$(ProgramFil
我正在构建一个包含几个解决方案的解决方案。除了其中一个以外,其他所有构建都没有任何问题。有问题的发出以下消息: Error 2 Unable to load one or more of the re
我正在使用 TeamCity 运行 MSBuild 脚本,该脚本可清理并重建我们的解决方案之一。当我部署由此进程生成的 dll 时,Web 服务器返回有关 [MyType].XmlSerializer
我的 .NET 3.5 库中有一个 sgen 构建步骤。在 VS2010 中,这会生成 .NET 4 MyLib.XmlSerializers.dll,无法从 .NET 3.5 应用程序加载它。有谁知
当我在 VS2013(版本 12.0.21005.1 REL)下编译我的 c# 解决方案时,它无法构建部分项目并出现错误消息: 错误 32 命令““C:\Program Files (x86)\Mic
是否可以使用 SGen garbage collector (来自单声道运行时)在常规 C/C++ 程序中?我认为单声道也使用了 Boehm-Demers-Weiser可用于 C/C++ 程序的保守垃
我有一个可以在我的本地机器上正常构建的项目,但是,当我使用 TFS 构建它时,我收到以下错误 - SGEN:尝试加载格式不正确的程序集: 在阅读了此处有关此主题的许多其他帖子后,大多数人只是说我需要将
我广泛使用 XmlSerializer,而不是让 .NET 在运行时生成必要的序列化程序集,我想提前生成这些程序集并将它们与我的应用程序捆绑在一起。我能够使用 Sgen 在构建时生成这些程序集。此外,
我希望能够在运行时检测 Mono 运行时是使用 Boehm GC 还是 SGen GC。我尝试使用谷歌搜索解决方案并花了一些时间浏览 Mono 文档,但找不到解决方案。有没有办法检测 Mono 在运行
我有以下类(都在同一个命名空间 Test.NamespaceTest 中定义): [XmlRootAttribute("rootTag")] public class BaseClass { } [X
我用 XMLSerializer 类做了一些事情。像大多数初学者一样,我在应用程序启动时遇到性能问题。我阅读了很多博客、文章,最后使用了 SGEN 工具。现在性能看起来还不错,但我还有一些不清楚的地方
我是一名优秀的程序员,十分优秀!