通过msbuild
目标标记我将文件(如果存在)复制到新目标并更改其名称(它正常工作):
<!--///////////////////////////Target CopyOldWebConfigJs//////////////////////////////////////////////-->
<Target Name="CopyOldWebConfigJs" Inputs="@(ContentFiltered)" Outputs="%(Identity).Dummy" DependsOnTargets="webConfigJsCase">
<Exec
Command= "copy "D:\p\Deployments\p\\WebPages\web.config.js" "$(AssemblyRoot)\WebPages\web.config.serverCopy.js""
/>
</Target>
<!-- New target to pre-filter list -->
<Target Name="webConfigJsCase"
Inputs="@(FileToPublish)"
Outputs="%(Identity).Dummy">
<ItemGroup>
<ContentFiltered Include="@(FileToPublish)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(FileToPublish.Filename)%(FileToPublish.Extension)', 'web.config.js')) AND Exists('D:\\p\\Deployments\\p\\WebPages\\web.config.js')" />
</ItemGroup>
</Target>
<!--///////////////////////////End Target CopyOldWebConfigJs//////////////////////////////////////////////-->
目标文件web.config.serverCopy.js
是具有键/值对内容的文件:
///////////////////////////////// TEST VERSION //////////////////////////////////////////////
//This is used for general web config settings for .js scripts that _webconfig. from staging to production
//It should not be edited or copied
_webconfig = new Object();
_webconfig.env = "pageq03"; // Needs Replacing
_webconfig.deployment = "p"; // Needs Replacing
_webconfig.relativeWebServicePath = "../WS/"; // Needs Replacing
_webconfig.webServiceFileName = "API.asmx"; // Needs Replacing
_webconfig.errorReportingThreshhold = "High"; // Setting for reporting bugs via email. Set to "Low" to report everything. ["Low", "Normal", "High" or "None"]
_webconfig.customPreviewPhaseDuration = 1000; //Setting that controls how long the automatic preview sits and resolves conflicts prior to showing the preview. Higher numbers increase performance while lower numbers enchance user experience.
//_webconfig.NewRelicAppID = {4}; //2805166
//J.A.C.K.A.L. settings (all false by default)
_webconfig.skipBootstrap = false;
_webconfig.skipJqueryUI = false;
_webconfig.skipPOCommon = false;
_webconfig.skipPOCampaignPreviews = false;
_webconfig.skipPOAjaxMonitor = false;
_webconfig.skipIconFonts = false;
_webconfig.skipCookie = false;
_webconfig.skipTouchPunch = false;
_webconfig.skipWebFont = false;
_webconfig.skipJSON = false;
_webconfig.skipKnob = false;
_webconfig.skipGoogleCharts = false;
_webconfig.jqueryuiTheme = "redmond";
//preview scrolling
_webconfig.previewScrollType = "always"; //none | onRender | onChange | Always
_webconfig.previewScrollSpeed = 500; //in milliseconds
//Dyanamic Menu
_webconfig.openMenuLinksInSearch = true;
//WIDGET SETTINGS
_webconfig.masterWidgetPath = "widgets/"; //end '/' required
_webconfig.widgetAnimateResize = false;
_webconfig.widgetAnimateSpeed = 100; //ms
_webconfig.widgetDestroyAnimationSpeed = 900;
_webconfig.widgetDebugModeOn = false;
_webconfig.widgetULIdToUse = "widgetSortable";
_webconfig.widgetToolbarAnchor = "#tblNavigationBar";
_webconfig.widgetFavoritesMiniMenuAnchor = ".navBarRight";
_webconfig.widgetScrollToDuration = 700; //in milliseconds
_webconfig.widgetSelectionIndicatorPhaseDuration = .5; //in seconds
_webconfig.widgetSelectionIndicatorNumOfPhases = 4;
_webconfig.allowUseOfWidgetFavorites = true;
_webconfig.POServicesAppName = "p.PO.Services"; // Needs Replacing
现在复制它(备份它)后,我有2个任务,我需要阅读他的内容和
_webconfig.deployment
持有的值 - 该值需要替换source
路径CopyOldWebConfigJs
目标代码Exec
命令的路径保持(现在硬编码) - 我不知道怎么做。// Needs Replacing
的每个键/值,我需要保存它的值并将其内容插入同一目录中的其他web.config.js
,具有相同的结构(相同的关键名称。)。我对MSBUILD
不熟悉,对此有任何帮助将非常感谢..