This is already cross hosted on MS Connect:
https://connect.microsoft.com/VisualStudio/feedback/details/560451
I am trying to override the $ property (MSBuildExtensionsPath) when creating a solution containing a C # web application project through msbuild. I do this because the csproj file of the web application imports the file "$ (MSBuildExtensionsPath) \ Microsoft \ VisualStudio \ v9.0 \ WebApplications \ Microsoft.WebApplication.targets". This file is installed by Visual Studio in the standard location $ (MSBuildExtensionsPath) (C: \ Program Files \ MSBuild). I would like to eliminate the dependency on this file installed on the computer (I would like my build servers to be as clean as possible). To do this, I would like to include Microsoft.WebApplication.targets in the source control with my project, and then override $ (MSBuildExtensionsPath) so that csproj will import this included version of Microsoft.WebApplication.targets.This approach allows me to remove the dependency without requiring me to manually modify the csproj file of the web application.
This scheme works fine when I create a solution file from the command line by supplying a custom value of $ (MSBuildExtensionsPath) on the command line for msbuild using the / p flag. However, if I try to build a solution using the MSBuild task in the MSbuild project file (overriding MSBuildExtensionsPath with the "Properties" attribute), it fails because the csproj file of the web application is trying to import Microsoft.WebApplication.targets files from the "standard "location Microsoft.WebApplication.targets (C: \ Program Files \ MSBuild). It is noteworthy that if I run msbuild using the "Exec" task in my user project file, it works. More importantly, the FIRST time I start the build using the "MSBuild" task AFTER I start the build,using the "EXEC" task (or directly from the command line), the assembly works.
- ? ? - , , MSBuild?
:
1) MSVS 2008 (Fake.sln)
2) - # (WebApplication1.csproj)
3) MSVS
4) "C:\Program Files\MSBuild \" "MSBuildExtensions" , .
5) "C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications", WebApplication1.csproj Microsoft.WebApplication.targets .
6) MSBuild "TestBuild.proj" , . :
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BuildMSBuild">
<PropertyGroup>
<MSBuildExtensionsPath>$(MSBuildProjectDirectory)\MSBuildExtensions\</MSBuildExtensionsPath>
<BuildThis>Fake.sln</BuildThis>
</PropertyGroup>
<Target Name="BuildMSBuild">
<MSBuild Projects="$(BuildThis)" Properties="MSBuildExtensionsPath=$(MSBuildExtensionsPath);" Targets="Clean" />
<MSBuild Projects="$(BuildThis)" Properties="MSBuildExtensionsPath=$(MSBuildExtensionsPath);"/>
</Target>
</Project>
7) "msbuild TestBuild.proj" MSVS ( : , , )