Reputation: 4092
In visual studio 2012, you can set a custom web server under
Web project properties -> Web -> Servers -> Use Custom Web Server
The UI doesn't allow this, but is it possible to specify different servers based off the build configuration (debug, release, etc.) in the project file?
Upvotes: 0
Views: 49
Reputation: 4092
It seems that there's no way to do this. I wanted to keep my Debug and Release (and other configuration) builds separate because we were doing things differently in both configurations (for example, minifying resources, etc.). Devs wanted their own config to skip certain projects that they didn't care about and the output differed.
I ended up using web.config transformations to point the web server to the folders that contained the bundle for the given config. We had to accomplish that by manually modifying the csproj file like this:
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
<!--Generate transformed web.config in the intermediate directory-->
<TransformXml Source="Web.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="Web.$(Configuration).config" />
<!--Force build process to use the transformed configuration file from now on.-->
<ItemGroup>
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>Web.config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
Upvotes: 1