Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude web.config when publishing with Visual Studio 2013?

When using the "Publish Web Site" feature in Visual Studio 2013. How can you exclude publishing the web.config so that it doesn't overwrite the server web.config?

The question is identical to the following except the VS version.

How to exclude web.config when publishing with Visual Web Developer Express?

However, its solution does not apply to VS2013. "Build Action" option cannot be found in VS2013. And setting "ExcludeFilesFromDeployment" causes compile problems.

like image 446
Lai Avatar asked May 04 '15 08:05

Lai


People also ask

Is Web config mandatory?

Yes, you will be able to run an ASP.NET application without a WEB. CONFIG file in its root folder. If the application doesn't find a WEB. CONFIG file in its root folder, then it will take MACHINE.

Where is web config file in Visual Studio?

config file is located in the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\ folder. The default settings that are contained in the Machine.

Does IIS Express use web config?

Yes, IIS Express uses the same applicationhost. config and web. config files supported by IIS.


1 Answers

For an legacy ASP.NET Web Application, add <ExcludeFilesFromDeployment>Web.config</ExcludeFilesFromDeployment> to the appropriate .xmlpub profile file found in the Properties\PublishProfiles folder.

<Project>
    <PropertyGroup>                          
        <ExcludeFilesFromDeployment>Web.config</ExcludeFilesFromDeployment>             
    </PropertyGroup>
</Project>  


    
like image 192
James Lawruk Avatar answered Sep 28 '22 01:09

James Lawruk