It is unnecessarily awkward to correctly do this based on the way that Microsoft.WebApplications.targets defines the _CopyWebApplication target and how Microsoft.Common.targets treats the OutDir and OutputPath properties.
If you want to change that in the project file itself then you should:
- Declare the property
WebProjectOutputDir after the import to Microsoft.WebApplications.targets
- Declare the property
OutDir before the import to Microsoft.WebApplications.targets
There are a few reasons why you have to do this.
Microsoft.WebApplications.targets will override any declaration of WebProjectOutputDir if it is declared before the import statement. Therefore it has to come after.
Also inside of Microsoft.WebApplications.targets the _CopyWebApplication is defined as follows:
<Target Name="_CopyWebApplication" Condition="'$(OutDir)' != '$(OutputPath)'" >
....
</Target>
Taking a look at the condition you will see that the target will not be executed if OutDir and OutputPath are equal to the same value. You cannot just change OutputPath because OutDir is based on OutputPath, so you have to change OutDir and make sure that it is before the import to that file because other properties are built based on that property.
Less than ideal, but hopefully that helps you.