RawBean
RawBean

Reputation: 462

Building InstallShield LE project with MSBuild - Error MSB4062

I work with Visual Studio 2012, and I just switched my deployment tools from NSIS to InstallShield. I've added new projects to my solution for InstallShield installers. When I build in Visual Studio (the IDE) I've no errors, no warnings and I'm happy.

Now, I want to have a script that build the full solution without launching the IDE. But when I run MSBuild in the command line, like that

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

I get following error 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.

My searches lead me to the conclusion that I must buy the Premier Edition of InstallShield to take profit of ISCmdBuild. But I can't afford it, and I think there might be another solution.

Any idea?

Upvotes: 3

Views: 5650

Answers (3)

Wolf5
Wolf5

Reputation: 17170

Using Fusion logging the MSBuild checks for the DLL here: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Build.Tasks.v3.5.DLL.

I copied c:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Build.Tasks.v3.5.dll to c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Tasks.v3.5.dll

And the error is gone.

Alternatively open your *.isproj file and change from "3.5" to "4.0" on top on the tag:

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

Upvotes: 5

ken2k
ken2k

Reputation: 49013

Another solution is to force MSBuild to use the x86 platform. See https://stackoverflow.com/a/1074699/870604

If you're building from a TFS build, this can be configured from the build options:

enter image description here

Upvotes: 3

RawBean
RawBean

Reputation: 462

I found the solution. Use the command devenv.exe instead of MSBuild.exe. It will be similar to launching Visual Studio and clicking the Build button. That's all!

devenv.exe MySolution.sln /build Release

Upvotes: 2

Related Questions