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.
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:
WebProjectOutputDir
after the import to Microsoft.WebApplications.targets
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With