Building with msbuild commandline link errors

Discussions about using Windows guests in VirtualBox.
Post Reply
nereus
Posts: 2
Joined: 13. Mar 2012, 15:39

Building with msbuild commandline link errors

Post by nereus »

Hi.

I hope this helps someone with similar trouble that I had to deal with.

I had to build Visual studio 2005 project on virtual machine from commandline.

The issue was: every time I run vbox in headless mode, msbuild on my sln project end up with link error:

Code: Select all

macro redefinition LINK : fatal error LNK1104: cannot open file '..\..\..\..\intermediate\win32\release\core\ManagerComputePart.obj'
Mind, that when VM runs in normal GUI mode, there were no error and everything builds perfectly.
nereus
Posts: 2
Joined: 13. Mar 2012, 15:39

Re: Building with msbuild commandline link errors

Post by nereus »

So.. here I was:
- Real HW configuration: Mac Mini Server 2.00 Ghz Intel i7, 8 GB ram,... Mac OS Lion
- Virtual machine HW: 2 CPU cores, 1.5 GB ram, ...
- Virtual machine guest OS was Windows XP, but similar behavior was in Windows 7 too
- Visual studio 2005
- VS project (*.sln) was located on host OS (Mac OS Lion) and guest OS (Windows) gets it throught Virtualbox shared folder. So basicaly in guest Windows, there were connected network disk (from host OS) where was the VS project.

Command that I run to build the project was:

Code: Select all

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe j:\MyVSProject\MyApplication\Projects\Win32\MyProject.sln /p:Configuration=Release /p:Platform=Win32 /t:rebuild

I ran virtualbox as a daemon on Mac OS, so there was a custom plist in /Library/LaunchDaemons/ that periodicly runs bash script which handles starting vbox and saving vm states.
In the bash script, I ran the virtualbox with this command:

Code: Select all

/usr/bin/VBoxHeadless --startvm $VM

SOLUTION:
After a MONTH of googling I almost lost faith and start to think about runnig vbox in GUI. But then I realized that headless mode can be run different. So I tried that:

Code: Select all

/usr/bin/VBoxManage startvm $VM --type headless
And voila! Suddenly msbuild start working as charm!

Only issue I had now is that "VBoxManage startvm" command doesn't wait or whatever, so LaunchDaemon is continuosly trying to start VM and gets error, that virtual machine is already running and locked. But this is not a big deal.


SO - if you are experiencing issues with building with msbuild from Windows running in headless virtualbox - try to run that headless mode with VBoxManage command.
Post Reply