Does anybody know, on a per project basis, whether you can set the WebProjectOutputDir in Visual Studio. I want to be able to have it so that when i hit Ctrl + Shift + B it automatically builds my web project to a specific directory, but I also need to be able to override this in my build script.
Does anybody know, on a per project basis, whether you can set the WebProjectOutputDir
Share
It is unnecessarily awkward to correctly do this based on the way that
Microsoft.WebApplications.targetsdefines the_CopyWebApplicationtarget and howMicrosoft.Common.targetstreats theOutDirandOutputPathproperties.If you want to change that in the project file itself then you should:
WebProjectOutputDirafter the import toMicrosoft.WebApplications.targetsOutDirbefore the import toMicrosoft.WebApplications.targetsThere are a few reasons why you have to do this.
Microsoft.WebApplications.targetswill override any declaration ofWebProjectOutputDirif it is declared before the import statement. Therefore it has to come after.Also inside of
Microsoft.WebApplications.targetsthe_CopyWebApplicationis defined as follows:Taking a look at the condition you will see that the target will not be executed if
OutDirandOutputPathare equal to the same value. You cannot just change OutputPath becauseOutDiris based onOutputPath, so you have to changeOutDirand 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.