2015-12-08 39 views
0

我使用AjaxMin来缩小我的.js和.css文件,这是在我的Release.pubxml文件中配置的,并且它工作正常,因为当我导航到Release/Package/PackageTemp文件夹时.js和.css已被正确缩小。Ajax Minifier部署包.zip

但是,当我导航到实际的Package .zip文件时.js和.css文件没有被缩小,它们只是原始文件。我假设我的PackageTemp中的文件没有替换Package部署文件,我不知道如何在我的.pubxml文件中实现这一点。我.pubxml文件目前看起来这本:

<?xml version="1.0" encoding="utf-8" ?> 
 
<!-- 
 
This file is used by the publish/package process of your Web project. You can customize the behavior of this process 
 
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
 
--> 
 
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
 
    <PropertyGroup> 
 
    <WebPublishMethod>Package</WebPublishMethod> 
 
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> 
 
    <LastUsedPlatform>Any CPU</LastUsedPlatform> 
 
    <SiteUrlToLaunchAfterPublish /> 
 
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> 
 
    <ExcludeApp_Data>True</ExcludeApp_Data> 
 
    <DesktopBuildPackageLocation>C:\Documents\TestDeploy</DesktopBuildPackageLocation> 
 
    <PackageAsSingleFile>true</PackageAsSingleFile> 
 
    <DeployIisAppPath /> 
 
    <PublishDatabaseSettings> 
 
     <Objects xmlns="" /> 
 
    </PublishDatabaseSettings> 
 
    </PropertyGroup> 
 

 
    <Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\AjaxMin.targets" /> 
 
    <PropertyGroup> 
 
    <OnAfterPackageUsingManifest> 
 
     $(OnAfterPackageUsingManifest); Minify; 
 
    </OnAfterPackageUsingManifest> 
 
    </PropertyGroup> 
 

 
    <Target Name="Minify" AfterTargets="CopyAllFilesToSingleFolderForPackage"> 
 
    <ItemGroup> 
 
     <JS Include="$(_PackageTempDir)\**\*.js" Exclude="$(_PackageTempDir)\**\*.min.js;" /> 
 
     <CSS Include="$(_PackageTempDir)\**\*.css" Exclude="$(_PackageTempDir)\**\*.min.css" /> 
 
    </ItemGroup> 
 

 
    <Message Text="**************MINIFYING**************" Importance="high"></Message> 
 
    <AjaxMin JsSourceFiles="@(JS)" JsSourceExtensionPattern="\.js$" JsTargetExtension=".js" CssSourceFiles="@(CSS)" CssSourceExtensionPattern="\.css$" CssTargetExtension=".css" /> 
 
    </Target> 
 

 
    <PropertyGroup> 
 
    <ExcludeFoldersFromDeployment>bin</ExcludeFoldersFromDeployment> 
 
    </PropertyGroup> 
 

 
</Project>
请可能有人阐明如何更换与PackageTemp文件我部署的.zip文件的文件中有一些光通过我.pubxml文件

谢谢

回答

0

我的错误,我只是注意到我正在使用OnAfterPackageUsingManifest选项。对于任何也面临此问题的人,请尝试使用OnBeforePackageUsingManifest选项。