2013-10-14 56 views
3

我使用Visual Studio 2012,并且只是将部署工具从NSIS切换到InstallShield。我为InstallShield安装程序的解决方案添加了新项目。当我在Visual Studio(IDE)中构建时,我没有任何错误,没有警告,我很高兴。使用MSBuild构建InstallShield LE项目 - 错误MSB4062

现在,我想要一个脚本来构建完整的解决方案,而无需启动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。但我负担不起,我认为可能有另一种解决方案。

有什么想法?

回答

2

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

devenv.exe MySolution.sln /build Release 
3

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

如果你从一个TFS建筑建设,这可以从build options进行配置:

enter image description here

+0

我没有TFS,所以我想你的第一个解决方案。不幸的是,MSBuild说“指定的解决方案配置Release | x86”是无效的。 – RawBean

4

使用融合在这里记录了的MSBuild检查的DLL:文件:/// 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 \框架\ v4.0.30319 \ Microsoft.Build.Tasks.v3.5.dll

错误消失了。

或者从“3.5”到“4.0”顶部打开* .isproj文件和变化对标签:

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

不幸的是,我需要管理员权限才能在此目录中复制文件。并且我没有它们... – RawBean

+0

然后尝试将InstallShield安装文件中的3.5更改为4.0: Wolf5

+0

我试过下面的值forToolsVersion {“4”,“4.0”,“4.5”,“4.0.30319”}。他们都没有工作。 – RawBean

相关问题