In Visual Studio 2012, Compress JS through smallsharp and modify web.config__c#

Source: Internet
Author: User
Add a targets file to your project named My.build.targets to add content to the targets file:
<?xml version= "1.0" encoding= "Utf-8"?> <project xmlns= "http://schemas.microsoft.com/developer/msbuild/" 2003 "> <ItemGroup> <cityindexjs include=" js/src/cityindex/_*.js;js/src/cityindex/i*.js;js/src/ Cityindex/page.js;js/src/cityindex/ready.js "/> </ItemGroup> <target name=" Buildjs "condition=" ' $ ( Configuration) ' = = ' release ' > <message text= ' building javascript files ... haha ' ></Message> <pack
  Er outputfilename= "js\cityindex.js" mode= "jsmin" inputfiles= "@ (CITYINDEXJS)" verbose= "true"/> </Target> <PropertyGroup> <webconfigpath>$ (samplefilesdir) \web.config</webconfigpath> </propertygroup > <target name= "updatereleasewebconfig" condition= "' $ (Configuration) ' = = ' Release '" > <message text= "upda Ting Web config ... haha "></Message> <updatewebconfig webconfigpath=" web.config "debug=" Fals E "customerrorsmode=" Remote/> </Target> &Lt;/project> 

Copy the Smallsharp file to a directory, such as Mylib.dll\msbuild\smallsharp download address unload project, and edit the project file to join at the top of the project file
  <import project= ". \ document \msbuild\smallsharp\msbuild.packer.targets "/>
  <import project= js.build.targets"/>
Add at the bottom of the project file
<target name= "Afterbuild" >
    <calltarget targets= "Updatereleasewebconfig"/>
    <calltarget targets= "Buildjs"/>
  </Target>

Executes using MSBuild, because the configuration=release pattern is used here, so you need to specify the parameters
MSBuild My.csproj/p:configuration=release   
Direct compilation In this vs will not perform compression and will only be performed through MSBuild
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.