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

3
我是一名有用的助手,可以为您翻译文本。
我使用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的Premier版本才能利用ISCmdBuild。但我买不起它,我认为可能有其他解决方案。 有什么想法吗?
3个回答

5
使用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" ...>

很不幸,我需要管理员权限才能在此目录中复制文件。而我没有这些权限... - RawBean
然后尝试在InstallShield安装文件中将版本从3.5更改为4.0:<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - Wolf5
我已经尝试了以下ToolsVersion的值 {"4", "4.0", "4.5", "4.0.30319"},但都没有起作用。 - RawBean
很奇怪...我不知道该说什么。 - RawBean
我又一次手动编辑了isproj文件,将其修改为"<Project ToolsVersion="3.5" ..."。但是我再次遇到了错误:"C:\Program Files (x86)\MSBuild\InstallShield\2013Limited\InstallShield.targets (21): The "Microsoft.Build.Tasks.AssignProjectConfiguration" task could not be loaded from the assembly Microsoft.Build.Tasks.v3.5."。 - Wolf5
显示剩余6条评论

3

我没有TFS,所以我尝试了你的第一个解决方案。不幸的是,MSBuild报错:“指定的解决方案配置 Release|x86 无效。” - RawBean

2
我找到了解决方案。使用命令devenv.exe而不是MSBuild.exe。这将类似于启动Visual Studio并单击“生成”按钮。就这样!
devenv.exe MySolution.sln /build Release

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接