使用MSBuild构建InstallShield LE项目 - 错误MSB4062

时间:2013-10-14 10:35:39

标签: visual-studio msbuild installshield

我使用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.

我的搜索引导我得出结论,我必须购买InstallShield专业版才能获利ISCmdBuild。但我负担不起,我认为可能还有另一种解决方案。

有什么想法吗?

3 个答案:

答案 0 :(得分:4)

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

我复制了 C:\ WINDOWS \ Microsoft.NET \框架\ 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" ...>

答案 1 :(得分:3)

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

如果您是从TFS构建构建的,可以从build options配置:

enter image description here

答案 2 :(得分:2)

我找到了解决方案。使用命令devenv.exe代替MSBuild.exe。它类似于启动Visual Studio并单击Build按钮。这就是全部!

devenv.exe MySolution.sln /build Release
相关问题