Friday, February 10, 2017

Restrict files from publishing into server - Web application



1)  Build Action: None
2a)  Copy to Output Directory: Do not copy
2b)  Copy to Output Directory: Copy always -----If you want to be in bin folder

------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <!--<publishUrl>C:\inetpub\wwwroot\SubProj</publishUrl>-->
    <publishUrl>..\BSS.SubProj.WebSetup\PublishedApplication</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <ExcludeFilesFromDeployment>bin\**\*.pdb</ExcludeFilesFromDeployment>

    <ExcludeFoldersFromDeployment>SqlServerTypes</ExcludeFoldersFromDeployment>
  </PropertyGroup>
  <Target Name="BeforeBuild">
    <ItemGroup>
      <ExcludeFromPackageFiles Include="Scripts\SubProj\**\*.js" Exclude="Scripts\SubProj\**\*min*.js">
        <FromTarget>Project</FromTarget>
      </ExcludeFromPackageFiles>
    </ItemGroup>
    <ItemGroup>
      <ExcludeFromPackageFiles Include="Scripts\SubProj\**\*min.js.map" Exclude="Scripts\SubProj\**\*min*.js">
        <FromTarget>Project</FromTarget>
      </ExcludeFromPackageFiles>
    </ItemGroup>
    <ItemGroup>
      <ExcludeFromPackageFiles Include="Content\SubProj\**\*.css" Exclude="Content\SubProj\**\*min*.css">
        <FromTarget>Project</FromTarget>
      </ExcludeFromPackageFiles>
    </ItemGroup>
  </Target>
</Project>


No comments:

Post a Comment

Encrypt/Decrypt the App.Config

Program.cs using System; using System.Diagnostics; using System.IO; namespace EncryptAppConfig {     internal class Program     {         pr...