deploy-site
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeploy Power Pages Code Site
部署Power Pages代码站点
Guide the user through deploying an existing Power Pages code site to a Power Pages environment using PAC CLI. Follow a systematic approach: verify tooling, authenticate, confirm the target environment, build and upload the site, and handle any blockers.
指导用户使用PAC CLI将现有的Power Pages代码站点部署到Power Pages环境。遵循系统化步骤:验证工具、认证身份、确认目标环境、构建并上传站点,以及处理任何阻碍问题。
Core Principles
核心原则
- Verify before acting: Always confirm PAC CLI availability, authentication status, and the target environment before attempting any deployment.
- Use TaskCreate/TaskUpdate: Track all progress throughout all phases — create the todo list upfront with all phases before starting any work.
- Never change environment settings without consent: If deployment requires modifying environment configuration (e.g., unblocking JavaScript attachments), always explain the change and get explicit user permission first.
Initial request: $ARGUMENTS
- 行动前先验证:在尝试任何部署操作前,务必确认PAC CLI可用、认证状态有效以及目标环境正确。
- 使用TaskCreate/TaskUpdate:跟踪所有阶段的进度——在开始任何工作前,预先创建包含所有阶段的待办事项列表。
- 未经许可绝不修改环境设置:如果部署需要修改环境配置(例如解除JavaScript附件的阻止),务必先向用户说明更改内容并获得明确许可。
初始请求:$ARGUMENTS
Phase 1: Verify PAC CLI
阶段1:验证PAC CLI
Goal: Ensure PAC CLI is installed and available on the system PATH
Actions:
-
Create todo list with all 6 phases (see Progress Tracking table)
-
Runto check if the PAC CLI is installed and available on the system PATH.
pac helppowershellpac help -
If the command succeeds: PAC CLI is installed. Proceed to Phase 2.
-
If the command fails (command not found / not recognized):
-
Inform the user that PAC CLI is required but not installed.
-
Fetch installation instructions fromusing the following approach:
https://aka.ms/PowerPlatformCLI-
Tell the user: "PAC CLI is not installed. You can install it by running:"powershell
dotnet tool install --global Microsoft.PowerApps.CLI.Tool -
Ifis also not available, direct the user to https://aka.ms/PowerPlatformCLI for full installation instructions including .NET SDK setup.
dotnet
-
-
After installation, verify by runningagain.
pac help -
If it still fails, stop and ask the user to resolve the installation manually.
-
Output: PAC CLI installed and verified
目标:确保PAC CLI已安装且可在系统PATH中访问
操作:
-
使用创建包含全部6个阶段的任务列表(见下方【进度跟踪】表格)
TaskCreate -
运行命令,检查PAC CLI是否已安装且可在系统PATH中访问。
pac helppowershellpac help -
若命令执行成功:PAC CLI已安装,进入阶段2。
-
若命令执行失败(命令未找到/无法识别):
-
告知用户需要PAC CLI但尚未安装。
-
通过以下方式从获取安装说明:
https://aka.ms/PowerPlatformCLI-
告知用户:“PAC CLI未安装。您可以运行以下命令进行安装:”powershell
dotnet tool install --global Microsoft.PowerApps.CLI.Tool -
如果也不可用,引导用户访问https://aka.ms/PowerPlatformCLI查看完整安装说明,包括.NET SDK的安装步骤。
dotnet
-
-
安装完成后,再次运行进行验证。
pac help -
若仍失败,停止操作并请用户手动解决安装问题。
-
输出:PAC CLI已安装并验证通过
Phase 2: Verify Authentication
阶段2:验证身份认证
Goal: Ensure the user is authenticated with PAC CLI and has a valid session
Actions:
-
Runto check the current authentication status.
pac auth whopowershellpac auth who -
If authenticated: Extract the following values from the output:
- Environment name and URL
- Environment ID — the GUID after
Environment ID: - Cloud — the value after (e.g.,
Cloud:,Public,UsGov,UsGovHigh,UsGovDod)China
Proceed to Phase 3. -
If not authenticated:
-
Inform the user they are not authenticated with PAC CLI.
-
Useto ask for the environment URL:
AskUserQuestionQuestion Header Options You are not authenticated with PAC CLI. Please provide your Power Pages environment URL (e.g., ) so I can authenticate you.https://org12345.crm.dynamics.comAuth (free text input via "Other") Provide two placeholder options to guide the user:- "I'll paste the URL" (description: "Select 'Other' below and paste your environment URL")
- "I don't know my URL" (description: "You can find it in the Power Platform admin center under Environments > your environment > Environment URL")
-
Once the user provides the URL, run the authentication command:powershell
pac auth create --environment "<USER_PROVIDED_URL>"This will open a browser window for the user to sign in. -
After the command completes, verify by runningagain.
pac auth who -
If authentication succeeds, proceed to Phase 3.
-
If authentication fails, present the error to the user and help them troubleshoot.
-
Output: Authenticated PAC CLI session with environment name and URL extracted
目标:确保用户已通过PAC CLI认证并拥有有效会话
操作:
-
运行命令检查当前认证状态。
pac auth whopowershellpac auth who -
若已认证:从输出中提取以下信息:
- 环境名称和URL
- 环境ID —— 后的GUID
Environment ID: - 云环境 —— 后的值(例如:
Cloud:、Public、UsGov、UsGovHigh、UsGovDod)China
进入阶段3。 -
若未认证:
-
告知用户尚未通过PAC CLI认证。
-
使用询问用户环境URL:
AskUserQuestion问题 标题 选项 您尚未通过PAC CLI认证。请提供您的Power Pages环境URL(例如: )以便为您完成认证。https://org12345.crm.dynamics.com身份认证 (通过“其他”选项进行自由文本输入) 提供两个占位选项引导用户:- “我将粘贴URL”(说明:“选择下方的‘其他’并粘贴您的环境URL”)
- “我不知道我的URL”(说明:“您可以在Power Platform管理中心的‘环境>您的环境>环境URL’中找到它”)
-
用户提供URL后,运行认证命令:powershell
pac auth create --environment "<USER_PROVIDED_URL>"这将打开浏览器窗口供用户登录。 -
命令完成后,再次运行进行验证。
pac auth who -
若认证成功,进入阶段3。
-
若认证失败,向用户展示错误信息并协助排查问题。
-
输出:已获取带环境名称和URL的PAC CLI认证会话
Phase 3: Confirm Environment
阶段3:确认目标环境
Goal: Ensure the user is deploying to the correct target environment
Actions:
-
Present the current environment information to the user and ask them to confirm.Usewith the following structure:
AskUserQuestionQuestion Header Options You are currently connected to environment: <ENV_NAME> (<ENV_URL>). Do you want to deploy to this environment? Environment Yes, use this environment, No, let me choose a different one -
If "Yes, use this environment": Proceed to Phase 4.
-
If "No, let me choose a different one":
-
Runto retrieve all available environments:
pac org listpowershellpac org list -
Parse the output to extract environment names and URLs.
-
Useto present the available environments as options (pick up to 4 most relevant, or let user specify).
AskUserQuestion -
Once the user selects an environment, switch to it:powershell
pac org select --environment "<SELECTED_ENV_ID_OR_URL>" -
Verify the switch by runningagain.
pac auth who
-
Output: Confirmed target environment for deployment
目标:确保用户部署到正确的目标环境
操作:
-
向用户展示当前环境信息并请求确认。使用,结构如下:
AskUserQuestion问题 标题 选项 您当前已连接到环境:<ENV_NAME>(<ENV_URL>)。是否要部署到此环境? 环境确认 是,使用此环境;否,让我选择其他环境 -
若选择“是,使用此环境”:进入阶段4。
-
若选择“否,让我选择其他环境”:
-
运行命令获取所有可用环境:
pac org listpowershellpac org list -
解析输出内容,提取环境名称和URL。
-
使用将可用环境作为选项展示给用户(最多显示4个最相关的,或让用户自行指定)。
AskUserQuestion -
用户选择环境后,切换到该环境:powershell
pac org select --environment "<SELECTED_ENV_ID_OR_URL>" -
再次运行验证切换是否成功。
pac auth who
-
输出:已确认部署的目标环境
Phase 4: Deploy the Code Site
阶段4:部署代码站点
Goal: Locate the project, build it, and upload to Power Pages
Actions:
目标:定位项目、构建站点并上传到Power Pages
操作:
4.1 Locate the Project Root
4.1 定位项目根目录
Determine the project root directory. The project root is the directory containing . Use to search for it:
powerpages.config.jsonGlobtext
**/powerpages.config.jsonIf found in the current working directory or a subdirectory, use that directory as . If multiple are found, ask the user which one to deploy using .
PROJECT_ROOTAskUserQuestionIf not found, ask the user to provide the path to the project root.
确定项目根目录。项目根目录是包含文件的目录。使用命令搜索该文件:
powerpages.config.jsonGlobtext
**/powerpages.config.json如果在当前工作目录或子目录中找到该文件,将该目录设为。如果找到多个,使用询问用户要部署哪个项目。
PROJECT_ROOTAskUserQuestion如果未找到,请用户提供项目根目录的路径。
4.2 Offer Permissions Audit (Redeployments Only)
4.2 提供权限审计选项(仅针对重新部署)
If already exists (i.e., this is not the first deployment), table permissions and site settings may have drifted from the code since the last deployment. Offer to audit before deploying.
.powerpages-siteUse :
AskUserQuestion| Question | Header | Options |
|---|---|---|
| This site has been deployed before. Would you like to run a permissions audit to verify table permissions match your current code before deploying? | Audit | Yes, audit permissions (Recommended), Skip — permissions are up to date |
If "Yes": Invoke to run the audit. After the audit completes, resume with Step 4.3.
If "Skip": Proceed to Step 4.3.
/audit-permissionsIf does not exist (first deployment), skip this step — there are no existing permissions to audit.
.powerpages-site如果目录已存在(即不是首次部署),表权限和站点设置可能与上次部署后的代码出现偏差。在部署前提供审计选项。
.powerpages-site使用:
AskUserQuestion| 问题 | 标题 | 选项 |
|---|---|---|
| 此站点已部署过。是否要在部署前运行权限审计,验证表权限是否与当前代码一致? | 权限审计 | 是,进行权限审计(推荐);跳过——权限已更新至最新 |
若选择“是”:调用运行审计。审计完成后,继续执行步骤4.3。
若选择“跳过”:直接进入步骤4.3。
/audit-permissions如果目录不存在(首次部署),跳过此步骤——没有现有权限需要审计。
.powerpages-site4.3 Build the Site
4.3 构建站点
Before uploading, ensure the site is built:
powershell
cd "<PROJECT_ROOT>"
npm run buildIf the build fails, stop and help the user fix the build errors before retrying.
上传前,确保站点已构建完成:
powershell
cd "<PROJECT_ROOT>"
npm run build如果构建失败,停止操作并协助用户修复构建错误后再重试。
4.4 Upload to Power Pages
4.4 上传到Power Pages
Run the upload command:
powershell
pac pages upload-code-site --rootPath "<PROJECT_ROOT>"If the upload succeeds: Proceed to Phase 5 to verify the deployment.
If the upload fails: Check the error message:
- If the failure is related to blocked JavaScript () attachments → proceed to Phase 6
.js - If the failure mentions type attachments are currently blocked → this is a misleading error. See Troubleshooting: HTML Blocked Attachment Error below
.html - For other errors → present the error to the user and help them troubleshoot
Output: Site built and uploaded to Power Pages
运行上传命令:
powershell
pac pages upload-code-site --rootPath "<PROJECT_ROOT>"若上传成功:进入阶段5验证部署结果。
若上传失败:检查错误信息:
- 如果失败与JavaScript(.js)附件被阻止相关 → 进入阶段6
- 如果失败提示**“当前环境阻止.html类型的附件”** → 这是一个误导性错误。请查看下方【故障排查:HTML附件被阻止错误】
- 其他错误 → 向用户展示错误信息并协助排查
输出:站点已构建并上传到Power Pages
Phase 5: Verify Deployment
阶段5:验证部署结果
Goal: Confirm the deployment was successful and handle post-deployment steps
Actions:
目标:确认部署成功并处理部署后步骤
操作:
5.1 Verify .powerpages-site
Folder
.powerpages-site5.1 验证.powerpages-site目录
Confirm exists and list its contents (, , ).
.powerpages-siteweb-roles/site-settings/table-permissions/确认目录存在并列出其内容(、、)。
.powerpages-siteweb-roles/site-settings/table-permissions/5.2 Record Skill Usage
5.2 记录技能使用情况
Reference:${CLAUDE_PLUGIN_ROOT}/references/skill-tracking-reference.md
Follow the skill tracking instructions in the reference to record this skill's usage. Use .
--skillName "DeploySite"参考:${CLAUDE_PLUGIN_ROOT}/references/skill-tracking-reference.md
按照参考文档中的技能跟踪说明记录本技能的使用情况,使用参数。
--skillName "DeploySite"5.3 Confirm Upload Output
5.3 确认上传输出
Review the output from the command in Phase 4 (or Phase 6 retry). Verify it reported a successful upload with no errors.
pac pages upload-code-site查看阶段4(或阶段6重试)中命令的输出,验证是否显示上传成功且无错误。
pac pages upload-code-site5.4 Commit Changes
5.4 提交变更
Stage and commit deployment artifacts:
powershell
git add -A
git commit -m "Deploy site to Power Pages"暂存并提交部署工件:
powershell
git add -A
git commit -m "Deploy site to Power Pages"5.5 Check Activation Status
5.5 检查激活状态
Run the activation status check:
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/check-activation-status.js" --projectRoot "<PROJECT_ROOT>"Evaluate the JSON result:
- If is
activated: Inform the user their site is already activated (showtrueif present). Proceed to step 5.6, then skip to Suggest Next Steps. Do NOT ask about activation.websiteUrl - If is
activated: Proceed to step 5.5.1.false - If is present: Fall back to step 5.5.1. Do not block the deployment flow.
error
运行激活状态检查命令:
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/check-activation-status.js" --projectRoot "<PROJECT_ROOT>"解析JSON结果:
- 若为
activated:告知用户站点已激活(若存在true则一并展示)。进入步骤5.6,然后跳转到【后续步骤建议】。无需询问激活相关问题。websiteUrl - 若为
activated:进入步骤5.5.1。false - 若存在:回退到步骤5.5.1,不要中断部署流程。
error
5.5.1 Ask About Activation (only if site is NOT already activated)
5.5.1 询问是否激活站点(仅当站点未激活时)
Ask the user if they want to activate the site using :
AskUserQuestion| Question | Header | Options |
|---|---|---|
| Site deployed successfully! Would you like to activate (provision) the site now so it gets a live URL? | Activate | Activate now (Recommended) — Provision the site with a subdomain and make it live, Skip for now — I'll activate later |
If "Activate now": Invoke the skill. After activation completes, proceed to step 5.6 to clear the site cache.
If "Skip for now": Suggest next steps (see Suggest Next Steps).
/activate-site使用询问用户是否要激活站点:
AskUserQuestion| 问题 | 标题 | 选项 |
|---|---|---|
| 站点部署成功!是否要立即激活(配置)站点,使其获得可用的在线URL? | 站点激活 | 立即激活(推荐)——为站点配置子域名并上线;稍后激活——我将手动激活 |
若选择“立即激活”:调用技能。激活完成后,进入步骤5.6清除站点缓存。
若选择“稍后激活”:查看【后续步骤建议】。
/activate-site5.6 Clear Site Cache (Only If Activated)
5.6 清除站点缓存(仅当站点已激活时)
After confirming the site is activated (either it was already activated in step 5.5, or the user just activated it in step 5.5.1), offer to clear the runtime cache so the deployed changes are immediately visible.
Prerequisites: The site must be activated and the project root must be known (from Phase 4.1).
Use to confirm before proceeding:
AskUserQuestion| Question | Header | Options |
|---|---|---|
| Would you like to restart the site so your latest changes are immediately visible? This may cause a brief downtime (a few seconds). | Restart | Yes, restart site (Recommended), Skip — I'll restart later |
If "Skip": Skip to Suggest Next Steps.
If "Yes": Run the cache-clearing script, passing the project root:
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/clear-site-cache.js" --projectRoot "<PROJECT_ROOT>"The script reads from , looks up the website via the Power Platform admin API, and restarts it to flush the runtime cache.
siteNamepowerpages.config.jsonEvaluate the result:
- If is
success: Inform the user: "Site cache cleared — your latest changes should now be visible at <websiteUrl>."true - If is
success: Warn the user that cache clearing failed and show the error, but do not block the deployment flow. The deployment itself succeeded; cache will eventually refresh on its own. Suggest the user can manually clear cache from the Power Pages admin center if needed.false
Output: Deployment verified, changes committed, activation offered, cache cleared
确认站点已激活后(无论是步骤5.5中发现已激活,还是用户刚在步骤5.5.1中完成激活),提供清除运行时缓存的选项,使部署的变更立即生效。
前提条件:站点已激活且已知项目根目录(来自阶段4.1)。
使用确认后再执行:
AskUserQuestion| 问题 | 标题 | 选项 |
|---|---|---|
| 是否要重启站点,使您的最新变更立即生效?这可能会导致短暂的停机(几秒时间)。 | 站点重启 | 是,重启站点(推荐);跳过——我稍后手动重启 |
若选择“跳过”:跳转到【后续步骤建议】。
若选择“是”:运行清除缓存脚本,传入项目根目录参数:
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/clear-site-cache.js" --projectRoot "<PROJECT_ROOT>"该脚本从中读取,通过Power Platform管理API查找对应网站并重启,以清除运行时缓存。
powerpages.config.jsonsiteName解析执行结果:
- 若为
success:告知用户:“站点缓存已清除——您的最新变更现在应该已在**<websiteUrl>**生效。”true - 若为
success:警告用户缓存清除失败并显示错误信息,但不要中断部署流程。部署本身已成功,缓存最终会自动刷新。建议用户如有需要可从Power Pages管理中心手动清除缓存。false
输出:部署已验证,变更已提交,激活选项已提供,缓存已清除
Phase 6: Handle Blocked JavaScript
阶段6:处理JavaScript被阻止问题
Goal: Resolve blocked JavaScript attachment errors and retry deployment
Actions:
目标:解决JavaScript附件被阻止的错误并重试部署
操作:
6.1 Explain the Issue
6.1 说明问题
Tell the user:
"The upload failed because JavaScript (.js) file attachments are blocked in your Power Pages environment. This is a security setting that prevents uploading .js files. To deploy a code site, this restriction needs to be relaxed for .js files."
告知用户:
“上传失败,因为您的Power Pages环境中阻止了JavaScript(.js)文件附件。这是一项安全设置,用于阻止上传.js文件。要部署代码站点,需要放宽对.js文件的限制。”
6.2 Ask for Permission
6.2 请求许可
Use :
AskUserQuestion| Question | Header | Options |
|---|---|---|
| Would you like to remove the JavaScript (.js) block from the environment's blocked attachments list? This is required to deploy code sites. | Unblock JS | Yes, remove the .js block (Recommended), No, do not change environment settings |
If "No": Stop and inform the user that the deployment cannot proceed without unblocking attachments.
.jsIf "Yes": Proceed to 6.3.
使用:
AskUserQuestion| 问题 | 标题 | 选项 |
|---|---|---|
| 是否要从环境的阻止附件列表中移除JavaScript(.js)的阻止?这是部署代码站点的必要操作。 | 解除JS阻止 | 是,移除.js阻止(推荐);否,不要修改环境设置 |
若选择“否”:停止操作并告知用户,不解除.js附件阻止则无法继续部署。
若选择“是”:进入6.3。
6.3 Update Blocked Attachments
6.3 更新阻止附件设置
-
Runto retrieve the current environment settings:
pac env list-settingspowershellpac env list-settings -
Find theproperty in the output. It will contain a semicolon-separated list of file extensions (e.g.,
blockedattachments).ade;adp;app;asa;ashx;asmx;asp;bas;bat;cdx;cer;chm;class;cmd;com;config;cnt;cpl;crt;csh;der;dll;exe;fxp;hlp;hta;htr;htw;ida;idc;idq;inf;ins;isp;its;js;jse;ksh;lnk;mad;maf;mag;mam;maq;mar;mas;mat;mau;mav;maw;mda;mdb;mde;mdt;mdw;mdz;msc;msh;msh1;msh1xml;msh2;msh2xml;mshxml;msi;msp;mst;ops;pcd;pif;prf;prg;printer;pst;reg;rem;scf;scr;sct;shb;shs;shtm;shtml;soap;stm;tmp;url;vb;vbe;vbs;vsmacros;vss;vst;vsw;ws;wsc;wsf;wsh -
Removefrom the list. Parse the semicolon-separated values, filter out
js, and rejoin with semicolons.js -
Update the setting:powershell
pac env update-settings --name blockedattachments --value "<UPDATED_LIST_WITHOUT_JS>" -
Confirm the update was successful.
-
运行命令获取当前环境设置:
pac env list-settingspowershellpac env list-settings -
在输出中找到属性,它包含一个用分号分隔的文件扩展名列表(例如:
blockedattachments)。ade;adp;app;asa;ashx;asmx;asp;bas;bat;cdx;cer;chm;class;cmd;com;config;cnt;cpl;crt;csh;der;dll;exe;fxp;hlp;hta;htr;htw;ida;idc;idq;inf;ins;isp;its;js;jse;ksh;lnk;mad;maf;mag;mam;maq;mar;mas;mat;mau;mav;maw;mda;mdb;mde;mdt;mdw;mdz;msc;msh;msh1;msh1xml;msh2;msh2xml;mshxml;msi;msp;mst;ops;pcd;pif;prf;prg;printer;pst;reg;rem;scf;scr;sct;shb;shs;shtm;shtml;soap;stm;tmp;url;vb;vbe;vbs;vsmacros;vss;vst;vsw;ws;wsc;wsf;wsh -
从列表中移除。解析分号分隔的值,过滤掉
js,再用分号重新连接。js -
更新设置:powershell
pac env update-settings --name blockedattachments --value "<UPDATED_LIST_WITHOUT_JS>" -
确认更新成功。
6.4 Retry Upload
6.4 重试上传
Run the upload command again:
powershell
pac pages upload-code-site --rootPath "<PROJECT_ROOT>"If it succeeds: Proceed to Phase 5 to verify the deployment.
If it fails again with a different error, present the error to the user and help troubleshoot.
Output: JavaScript unblocked and site deployed successfully
再次运行上传命令:
powershell
pac pages upload-code-site --rootPath "<PROJECT_ROOT>"如果成功:进入阶段5验证部署结果。
如果再次失败且错误不同,向用户展示错误信息并协助排查。
输出:JavaScript已解除阻止,站点部署成功
Troubleshooting: HTML Blocked Attachment Error
故障排查:HTML附件被阻止错误
If the upload fails with an error like:
Error: Unable to upload webfile name 'index.html' with record Id <GUID> as '.html' type attachments are currently blocked on this environment.This error is misleading. The extension is not actually blocked — the real cause is a stale environment manifest file in the folder. This manifest maps local files to Dataverse record IDs from a previous upload. When the mapping becomes outdated (e.g., after environment changes or record deletions), the upload fails with this confusing error.
.html.powerpages-site如果上传失败并出现如下错误:
Error: Unable to upload webfile name 'index.html' with record Id <GUID> as '.html' type attachments are currently blocked on this environment.此信息具有误导性。扩展名并未被实际阻止——真正原因是目录中的环境清单文件已过期。该清单文件将本地文件映射到上次上传时的Dataverse记录ID。当映射过期时(例如环境变更或记录删除后),上传会失败并显示这个易混淆的错误。
.html.powerpages-siteFix
修复方法
-
Locate the environment-specific manifest file in thefolder. It follows the naming pattern
.powerpages-site(e.g.,<environment-host>-manifest.yml). List the folder contents to find it:demo1.crm.dynamics.com-manifest.ymlpowershellGet-ChildItem -Path "<PROJECT_ROOT>/.powerpages-site" -Filter "*-manifest.yml" -
Delete the manifest file:powershell
Remove-Item -Path "<PROJECT_ROOT>/.powerpages-site/<environment-host>-manifest.yml" -
Retry the upload:powershell
pac pages upload-code-site --rootPath "<PROJECT_ROOT>"
If the retry succeeds, proceed to Phase 5. If it fails with a different error, present the error to the user and help them troubleshoot.
Important: Do NOT attempt to unblockin the environment's blocked attachments list — the error is not caused by the attachment block setting..html
-
在目录中找到环境特定的清单文件,其命名格式为
.powerpages-site(例如:<environment-host>-manifest.yml)。列出目录内容以找到该文件:demo1.crm.dynamics.com-manifest.ymlpowershellGet-ChildItem -Path "<PROJECT_ROOT>/.powerpages-site" -Filter "*-manifest.yml" -
删除该清单文件:powershell
Remove-Item -Path "<PROJECT_ROOT>/.powerpages-site/<environment-host>-manifest.yml" -
重试上传:powershell
pac pages upload-code-site --rootPath "<PROJECT_ROOT>"
如果重试成功,进入阶段5。如果再次失败且错误不同,向用户展示错误信息并协助排查。
重要提示:不要尝试在环境的阻止附件列表中解除的阻止——错误并非由附件阻止设置导致。.html
Suggest Next Steps
后续步骤建议
If the user skips activation (or after activation completes), suggest:
- — Provision the site with a subdomain and make it live (if not already activated)
/activate-site - — Test the deployed site in the browser (verify pages load, check API calls)
/test-site - — Audit table permissions against current code (recommended after redeployments)
/audit-permissions - — Create Dataverse tables for dynamic content
/setup-datamodel - — Add meta tags, robots.txt, sitemap.xml, favicon
/add-seo
如果用户跳过激活(或激活完成后),建议:
- —— 为站点配置子域名并上线(若尚未激活)
/activate-site - —— 在浏览器中测试已部署的站点(验证页面加载、API调用)
/test-site - —— 对照当前代码审计表权限(重新部署后推荐执行)
/audit-permissions - —— 为动态内容创建Dataverse表
/setup-datamodel - —— 添加元标签、robots.txt、sitemap.xml、网站图标
/add-seo
Important Notes
重要注意事项
NEVER Use pac pages upload
pac pages upload切勿使用pac pages upload
pac pages uploadAlways use — never use . The command is designed for portal-studio-style sites and will corrupt code site metadata if used on a code site project. This applies to every upload step in this skill (Phase 4.4, Phase 6.4, and troubleshooting retries).
pac pages upload-code-sitepac pages uploadpac pages upload始终使用——绝不使用。命令专为Portal Studio风格的站点设计,若用于代码站点项目会损坏元数据。本技能的所有上传步骤(阶段4.4、阶段6.4以及故障排查中的重试)均适用此规则。
pac pages upload-code-sitepac pages uploadpac pages uploadThroughout All Phases
所有阶段通用规则
- Use TaskCreate/TaskUpdate to track progress at every phase
- Ask for user confirmation at key decision points (see list below)
- Present errors clearly — when a command fails, show the user the relevant error output and explain what went wrong before suggesting fixes
- 使用TaskCreate/TaskUpdate跟踪每个阶段的进度
- 在关键决策点请求用户确认(见下方列表)
- 清晰展示错误信息——命令失败时,向用户展示相关错误输出并解释问题原因,然后再提出修复建议
Key Decision Points (Wait for User)
关键决策点(需等待用户操作)
- After Phase 2: If not authenticated, get environment URL from user
- At Phase 3: Confirm or switch the target environment
- At Phase 4.1: If multiple found, ask which project to deploy
powerpages.config.json - At Phase 4.2: Audit permissions now or skip (redeployments only)
- At Phase 5.5: Activate site now or later
- At Phase 6: Get permission before modifying blocked attachments setting
- 阶段2之后:若未认证,向用户获取环境URL
- 阶段3:确认或切换目标环境
- 阶段4.1:若找到多个,询问用户要部署哪个项目
powerpages.config.json - 阶段4.2:是否立即审计权限或跳过(仅针对重新部署)
- 阶段5.5:立即激活站点还是稍后激活
- 阶段6:修改阻止附件设置前获取用户许可
Progress Tracking
进度跟踪
Before starting Phase 1, create a task list with all phases using :
TaskCreate| Task subject | activeForm | Description |
|---|---|---|
| Verify PAC CLI installation | Verifying PAC CLI | Check if PAC CLI is installed, install if missing |
| Verify authentication | Verifying authentication | Check current auth status, authenticate if needed |
| Confirm target environment | Confirming environment | Show current environment, let user confirm or switch |
| Deploy the code site | Deploying site | Locate project root, build, and upload via pac pages upload-code-site |
| Verify deployment | Verifying deployment | Confirm .powerpages-site folder exists, review upload output, commit changes, offer activation |
| Handle blocked JavaScript | Resolving JS block | If upload fails due to blocked JS, offer to unblock and retry |
Mark each task when starting it and when done via . Phase 6 may be marked immediately if no JavaScript blocking issue is encountered. This gives the user visibility into progress and keeps the workflow deterministic.
in_progresscompletedTaskUpdatecompletedBegin with Phase 1: Verify PAC CLI
在开始阶段1前,使用创建包含所有阶段的任务列表:
TaskCreate| 任务主题 | activeForm | 描述 |
|---|---|---|
| 验证PAC CLI安装 | 验证PAC CLI | 检查PAC CLI是否已安装,若缺失则进行安装 |
| 验证身份认证 | 验证身份认证 | 检查当前认证状态,若需要则完成认证 |
| 确认目标环境 | 确认环境 | 展示当前环境,让用户确认或切换 |
| 部署代码站点 | 部署站点 | 定位项目根目录、构建站点并通过pac pages upload-code-site上传 |
| 验证部署结果 | 验证部署 | 确认.powerpages-site目录存在、查看上传输出、提交变更、提供激活选项 |
| 处理JavaScript被阻止问题 | 解决JS阻止问题 | 若上传因JS被阻止失败,提供解除阻止并重试的选项 |
开始每个阶段时,将对应任务标记为;完成后标记为(通过)。如果未遇到JavaScript阻止问题,阶段6可直接标记为。这能让用户清晰看到进度并确保工作流程可预测。
in_progresscompletedTaskUpdatecompleted从阶段1开始:验证PAC CLI