c# 任务失败,因为未找到AL.exe,

更新时间:2024-04-18 下载TXT文档 下载Word文档

编译项目时出现以下错误:

Task failed because"AL.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for"AL.exe" in the"bin" subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A. You may be able to solve the problem by doing one of the following:

  • Install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5.
  • Install Visual Studio 2008.
  • Manually set the above registry key to the correct location.
  • Pass the correct location into the"ToolPath" parameter of the task.
  • 将资源文件添加到我的UnitTest项目中的文件夹时,会出现此错误。 我的程序没有直接将这些资源文件用于本地化,它们就像普通文件一样。 我需要它们来对程序中的某些逻辑进行单元测试,该逻辑使用ResXResourceReader加载这些资源文件。

    有人可以解释一下为什么会出现这个错误吗?

    编辑:
    安装Windows SDK可以解决此问题,错误中也对此进行了描述。 但是我仍然想知道为什么会出现错误。 我对我没有任何意义。

    • 我也有同样的问题。 由于公司的政策,我无法安装Microsoft Windows SDK,甚至因为我拥有Web应用程序(ASP.NET,C#,MVC Framework,i18n)而不是Windows应用程序,所以我也不会这样做。 另外,我无权编辑注册表项。

    之所以会出现此错误,是因为您正在构建一个使用程序集清单的3.5项目,但没有安装3.5工具。 (希望有人可以提供更多信息。)

    我强烈建议安装适用于Windows 7和.NET Framework 3.5 SP1的Microsoft Windows SDK,并避免这种攻击,尤其是在仅需要安装工具的情况下,请务必查看发行说明以了解AL.exe信息。 (由于存在安全更新修复程序,建议将该SDK安装为3.5版。)

    SDK的"发行说明"表明ALTOOLPATH由Visual Studio 2005设置,这可能解释了为什么某些用户在构建时遇到问题。这是我的猜测。

    使用SysInternals的Process Monitor,在构建3.5项目时,Visual Studio 2008在%SystemRoot% Microsoft.NET Framework v3.5文件夹中查找程序集链接器(AL.exe)。如果找不到AL,它将使用特定的v6.0A注册表设置中指定的位置。 (请注意,v6.0A不适用于.NET 3.5。)因此,请安装适当的软件,请勿乱砍。 :O)

    我的问题是Assembly Linker在2.0、3.0和3.5之间有所不同吗?

    Windows SDK for Windows Server 2008 and .NET Framework 3.5

    Installing the newly released
    Microsoft Windows SDK for Windows 7
    and .NET Framework 3.5 SP1 instead of
    this release is recommended. If you do
    go ahead and install this SDK after
    VS2008 SP1, please ensure the patch
    described in Knowledge Base 974479 is
    applied. See Overview section for more
    information.

    卸载项目,然后编辑.csproj文件,您将看到一个导入任务

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

    如果您的项目目标是.Net 3.5,则MSBuildBinPath =" C: WINDOWS Microsoft.NET Framework v3.5"

    然后去

    C: WINDOWS Microsoft.NET Framework v3.5 Microsoft.CSharp.targets文件

    在记事本中打开此文件并搜索AL任务,您将得到类似这样的信息 (短码网-duanma.net)

     <AL AlgorithmId="$(Satellite_AlgorithmId)"
                BaseAddress="$(Satellite_BaseAddress)"
                CompanyName="$(Satellite_CompanyName)"
                Configuration="$(Satellite_Configuration)"
                Copyright="$(Satellite_Copyright)"
                Culture="%(Culture)"
                DelaySign="$(DelaySign)"
                Description="$(Satellite_Description)"
                EmbedResources="@(_SatelliteAssemblyResourceInputs)"
                EvidenceFile="$(Satellite_EvidenceFile)"
                FileVersion="$(Satellite_FileVersion)"
                Flags="$(Satellite_Flags)"
                GenerateFullPaths="$(Satellite_GenerateFullPaths)"
                KeyContainer="$(KeyContainerName)"
                KeyFile="$(KeyOriginatorFile)"
                LinkResources="@(Satellite_LinkResource)"
                MainEntryPoint="$(Satellite_MainEntryPoint)"
                OutputAssembly="$(IntermediateOutputPath)%(Culture)\$(TargetName).resources.dll"
                Platform="$(PlatformTarget)"
                ProductName="$(Satellite_ProductName)"
                ProductVersion="$(Satellite_ProductVersion)"
                ResponseFiles="@(AlResponseFile)"
                SourceModules="@(Satellite_SourceModule)"
                TargetType="$(Satellite_TargetType)"
                TemplateFile="$(IntermediateOutputPath)$(TargetName)$(TargetExt)"
                Title="$(Satellite_Title)"
                ****ToolPath="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"****
                Trademark="$(Satellite_Trademark)"
                Version="$(Satellite_Version)"
                Win32Icon="$(Satellite_Win32Icon)"
                Win32Resource="$(Satellite_Win32Resource)">
    
                <Output TaskParameter="OutputAssembly" ItemName="FileWrites"/>
    
            </AL>

    请注意,我将ToolPath更改为计算机上AL所在的位置。

    默认情况下,它使用$(AlToolPath),不知道此属性的值是什么,但是我确定如果您遇到此错误,则它没有指向正确的位置

    简而言之,AL任务找不到AL.exe,当您编辑它并提供ToolPath值时,您可以帮助他找到它。

    希望这可以解释您为什么收到此错误消息。

    • 我只想添加,在VS编译器输出中写入未找到AL.exe的路径。 因此很容易看到在哪里找不到AL.exe。 您可以编辑配置,也可以只是从此路径位置中的某处复制AL.exe。 从最佳实践的角度来看,它当然不是很好,但是速度更快,您不需要编辑配置。

    无需在Build服务器上安装VS2010。

    从开发框中导出" v7.0A"键,然后将其导入到构建服务器的注册表中。只需确保将任何"程序文件(x86)"重命名为"程序文件"即可,具体取决于运行的Windows服务器版本。

    • HKEY_LOCAL_MACHINE SOFTWARE Microsoft Microsoft SDKs Windows v7.0A-这是注册表项吗?

    我遇到了同样的错误,这是由于将资源文件从Webforms修改为MVC3时,将资源文件添加到本地文件夹并将生成操作更改为" Embedded Resources"(资源->属性),请参见MVC2全球化。确切的错误是由Resources.lang.resx包含"。"引起的。名称(与"嵌入式资源"结合使用)。

    以前,该应用程序在使用具有"内容"(App_GlobalResources)的构建动作的全局资源时进行了编译并运行良好。

    该解决方案类似于上面的@vicky kole,但是我认为仍然值得一提,因为之前的工作项目中存在一些差异以及al.exe错误的确切原因。

    经过一些故障排除后,我安装了Windows 7和ASP.NET 4 SDK,并通过搜索将al.exe定位在C: Program Files Microsoft SDKs Windows v7.1 Bin x64文件夹中。

    然后,我搜索了C: WINDOWS Microsoft.NET Framework * NEWEST VERSION * *。target,直到找到与上述@vicky kole相同的AL节点。它在另一个名为Microsoft.Common.targets的文件中。在我的情况下,我从新安装的SDK C: Program Files Microsoft SDKs Windows v7.1 Bin x64中获取路径,并将其放入ToolPath中,就像vicky一样,然后重新启动Visual Studio。

    <AL AlgorithmId="$(Satellite_AlgorithmId)"
    ToolPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\x64"

    (这可能是对她的帖子的评论,因为它与她的情况非常相似)

    我做的和dcadenas一样,只是从开发机上复制了SDKs 7.0A文件夹,并将v7.0A注册表设置从开发箱导出到了构建服务器。这非常有效,因为我不需要在构建服务器上安装VS 2010。谢谢。

    在Windows 10中无法找到resgen.exe工具的项目中,我遇到了类似的错误。我必须将HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFX35Tools-x86中的InstallationFolder注册表项更改为计算机上实际存在的路径:C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin
    ETFX 4.6.2 Tools

    使用TFS 2010和针对3.5框架的项目时,已在Connect上完成了报告。它的解决方案为我工作。

    https://connect.microsoft.com/VisualStudio/feedback/details/594338/tfs-2010-build-agent-and-windows-7-1-sdk-targeting-net-3-5-generates-wrong-embedded-资源

    重新安装Visual Studio后解决的问题

    以上就是短码网小编为大家整理的《c# 任务失败,因为未找到AL.exe,》相关内容,希望大家喜欢。

    本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

    如若内容造成侵权/违法违规/事实不符,请将联系本站反馈,一经查实,立即处理!

    c# 任务失败,因为未找到AL.exe,》文档下载仅供参考学习,下载后请在24小时内删除。

    转载注明出处:https://www.duanma.net/article/69d1acf0897.html

    回到顶部