Building a solution containing a web application project using MSBuild from powershell, like this:
msbuild "/p:OutDir=$build_dir\" $solution_file
Works fine for me on a 32-bit, but on a 64-bit machine, I ran into this error:
error MSB4019: The imported project "C: \ Program Files \ MSBuild \ Microsoft \ VisualStudio \ v9.0 \ WebApplications \ Microsoft.WebApplication.targets" was not found. Verify that the path in the declaration is correct and that the file exists on disk.
I am using Visual Studio 2008 and powershell v2. The problem is already registered here and here . Mostly on a 64-bit VS installation, the Microsoft.WebApplication.targets files needed by MSBuild are located in the Program Files (x86) directory and not in the Program Files directory, but MSBuild does not recognize this and therefore looks in the wrong place.
Two solutions that I still are not perfect:
- Manually copy the file to the 64-bit Program Files (x86) file in the Program Files. This is a bad decision - every developer will have to do it manually.
- Manually edit the csproj file so that MSBuild looks in the right place. Again, not perfect: I would prefer not to require that everyone in 64-bit language manually edit csproj files in each new project.
eg.
<Import Project="$(MSBuildExtensionsPathx86)\$(WebAppTargetsSuffix)" Condition="Exists('$(MSBuildExtensionsPathx86)\$(WebAppTargetsSuffix)')" />
Ideally, I want MSBuild to be able to import the target file to the right place from the command line, but I cannot figure out how to do that . Any solutions?
source share