我正在使用AjaxMin来缩小我的.js和.css文件这是在我的Release.pubxml文件中配置的,它工作得很好,因为当我导航到Release/Package/PackageTemp文件夹时,.js和.css已经被正确地缩小了。
然而,当我导航到实际的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:DocumentsTestDeploy</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath />
<PublishDatabaseSettings>
<Objects xmlns="" />
</PublishDatabaseSettings>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)MicrosoftMicrosoftAjaxAjaxMin.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>
请有人介绍一下如何通过我的.pubxml文件将我的deploy.zip文件中的文件替换为PackageTemp文件
感谢
我刚刚注意到我使用了OnAfterPackageUsingManifest选项。对于同样面临此问题的任何人,请尝试使用OnBeforePackageUsingManifest选项。