We use ajaxmin to create .min.js files from all our .js files. We have edited the .csproj file of the project and added following:
<Import Project="$(MSBuildExtensionsPath32)MicrosoftMicrosoftAjaxajaxmin.tasks" />
<Target Name="AfterBuild">
<ItemGroup>
<JS Include="***.js" Exclude="***.min.js" />
</ItemGroup>
<AjaxMin JsSourceFiles="@(JS)" JsSourceExtensionPattern=".js$" JsTargetExtension=".min.js" />
</Target>
This works great when we build the site on our workstation and the .min.js files can be used in the site. When we check this project in this task runs also on the msbuild server but the .min.js files generated by ajaxmin are not copied to the drop location of the tfs2010 Rolling Build we use. These .min.js files are also not included into the package we create during this rolling build and which is also copied to the drop location. Only the files included into the project are used for the package and copied to the drop location.
The MSBuild Arguments we use to create the package are the following:
/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=InProc /p:CreatePackageOnPublish=True /p:MSDeployServiceURL=localhost
I've tried several things as adding an extra build task to copy all the .min.js files to the location where the package is created. I tried also the following url http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx to include this files with the following in my .csproj file:
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="***.min.js" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
Has anyone else also this problem or does anyone have an idea how to include the *.min.js files in the msdeploy package and make the files copy to the drop location?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…