2013-10-14 57 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

相關問題