Adding files to Azure cspkg in afterbuild msbuild event? -
i have mvc application have got working on azure apart getting published .cspkg file include css/jscript created in afterbuild process (this works if publish normal server isn't using azure).
in afterbuild process minify , merge files add them deploy zip:
<packagelocation>..\deploy\website.zip</packagelocation> <propertygroup> <copyallfilestosinglefolderforpackagedependson> customcollectfiles; $(copyallfilestosinglefolderforpackagedependson); </copyallfilestosinglefolderforpackagedependson> </propertygroup>
what msbuild code need change in order same task adding cspkg instead?
here how did it. in example have .csproj file part of azure solution , dll produced c# project needs particular xml file live right next in deployment. here msbuild fragments .csproj file show technique. can place of code below import of microsoft.csharp.targets in .csproj file.
<!-- identify xml input file must deployed next our dll. --> <itemgroup> <specialxmlfileitem include="c:\temp\myspecialfile.xml" /> </itemgroup> <propertygroup> <!-- in case needed as-deployed xml filename fixed , yet wanted possible provide filename @ provided source. here defining fixed, as-deployed filename. --> <asdeployedxmlfilename>myservicestorageconfig.xml</asdeployedxmlfilename> <!-- wire our own addfilestoprojectdeployment target getcopytooutputdirectoryitems target. target evaluated not part of normal .csproj evaluation, part of .ccproj evaluation. how .ccproj manages interrogate dll producing projects of project files need packaged. --> <getcopytooutputdirectoryitemsdependson> addfilestoprojectdeployment; $(getcopytooutputdirectoryitemsdependson) </getcopytooutputdirectoryitemsdependson> </propertygroup> <target name="addfilestoprojectdeployment"> <error condition="!exists('@(specialxmlfileitem)')" text="the important , special xml file not found: %(specialxmlfileitem.itemspec)" /> <itemgroup> <contentwithtargetpath include="@(specialxmlfileitem->'%(fullpath)')"> <!-- in case wanted deploy xml file right next .dll, included no relative path information in below value of targetpath, simple filename. but, think if included relative path information in below value preserved in deployment. --> <targetpath>$(asdeployedxmlfilename)</targetpath> <copytooutputdirectory>always</copytooutputdirectory> </contentwithtargetpath> </itemgroup> </target>
-bern mccarty
Comments
Post a Comment