We use ajaxmin to create .min.js files from all of our .js files. We edited the project's .csproj file and added the following:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\MicrosoftAjax\ajaxmin.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 create a site on our workstation, and .min.js files can be used on the site. When we test this project in this task, it also runs on the msbuild server, but the .min.js files generated by ajaxmin are not copied to the drag and drop location of the tfs2010 Rolling Build we use. These .min.js files are also not included in the package that we create during this rolling assembly, which is also copied to the drop folder. Only the files included in the project are used for the package and are copied to the folder.
The MSBuild arguments we use to create the package are as follows:
/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=InProc /p:CreatePackageOnPublish=True /p:MSDeployServiceURL=localhost
I tried several things, adding an additional build task to copy all the .min.js files to the place where the package is being created. I also tried the following url http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx to include these 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>
Does anyone else have this problem or does anyone have an idea how to include * .min.js files in the msdeploy package and make the files copied to the drop folder?
source
share