【问题标题】:Building InstallShield LE project with MSBuild - Error MSB4062使用 MSBuild 构建 InstallShield LE 项目 - 错误 MSB4062
【发布时间】:2013-10-14 10:35:38
【问题描述】:

我使用 Visual Studio 2012,我刚刚将我的部署工具从 NSIS 切换到 InstallShield。我已将新项目添加到我的 InstallShield 安装程序解决方案中。当我在 Visual Studio(IDE)中构建时,我没有错误,没有警告,我很高兴。

现在,我想要一个无需启动 IDE 即可构建完整解决方案的脚本。但是当我在命令行中运行 MSBuild 时,就像那样

MSBuild MySolution.sln /t:Build /p:Configuration=Release

我收到以下错误 MSB4062

C:\Program Files (x86)\MSBuild\InstallShield\2012SpringLimited\InstallShield.targets(21,3): error MSB4062: The "Microsoft.Build.Tasks.AssignProjectConfiguration" task could not be loaded from the assembly Microsoft.Build.Tasks.v3.5. Could not load file or assembly 'Microsoft.Build.Tasks.v3.5' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

我的搜索使我得出结论,我必须购买 Premier Edition 的 InstallShield 才能从 ISCmdBuild 中获利。但我买不起,我认为可能还有其他解决方案。

有什么想法吗?

【问题讨论】:

    标签: visual-studio msbuild installshield


    【解决方案1】:

    在此处使用 Fusion 记录 MSBuild 检查 DLL:file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Build.Tasks.v3.5.DLL。

    我复制了 c:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Build.Tasks.v3.5.dll 到 c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Tasks.v3.5.dll

    错误消失了。

    或者打开您的 *.isproj 文件并将标签顶部的“3.5”更改为“4.0”:

    <Project ToolsVersion="3.5"...> --> <Project ToolsVersion="4.0" ...>
    

    【讨论】:

    • 不幸的是,我需要管理员权限才能在此目录中复制文件。而我没有它们......
    • 然后尝试在 InstallShield 安装文件中从 3.5 更改为 4.0:schemas.microsoft.com/developer/msbuild/2003">
    • 我已经尝试过以下值 forToolsVersion {"4", "4.0", "4.5", "4.0.30319"}。它们都不起作用。
    • 为我工作。我删除了 DLL 并在 isproj 文件中更改了该值,签入并在没有 3.5 引用错误的情况下构建。
    • 这很奇怪...我不知道该说什么。
    【解决方案2】:

    另一个解决方案是强制 MSBuild 使用 x86 平台。见https://stackoverflow.com/a/1074699/870604

    如果您从 TFS 构建构建,则可以从 build options 进行配置:

    【讨论】:

    • 我没有 TFS,所以我尝试了您的第一个解决方案。不幸的是,MSBuild 说“指定的解决方案配置 Release|x86”无效。
    【解决方案3】:

    我找到了解决方案。使用命令devenv.exe 而不是MSBuild.exe。这类似于启动 Visual Studio 并单击“构建”按钮。就是这样!

    devenv.exe MySolution.sln /build Release
    

    【讨论】:

      猜你喜欢
      • 2019-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-16
      • 1970-01-01
      • 2014-04-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多