Skip to content

Commit a299797

Browse files
committed
fix(windows): drop dead dotnet-bridge marker check
The skip check and sentinel fallback looked for dotnet-bridge under platforms/windows/<app>/, but the bridge lives at platforms/windows/dotnet-bridge, so the skip never fired and every prepare logged 'publish directory not found'. dotnet-tool and the bridge csproj already write the marker at the right path.
1 parent eecb511 commit a299797

1 file changed

Lines changed: 16 additions & 59 deletions

File tree

‎lib/services/windows-project-service.ts‎

Lines changed: 16 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -497,70 +497,27 @@ export class WindowsProjectService
497497
projectData.projectName,
498498
);
499499

500-
// Attempt to run dotnet-tool to publish/copy DotNetBridge and app projects if available
500+
// Run dotnet-tool to publish DotNetBridge. It (and the bridge csproj) write
501+
// dotnet-bridge/publish/.dotnet_tool_done, which the app csproj waits on.
501502
try {
502-
const marker = path.join(appProjectDir, "dotnet-bridge", "publish", ".dotnet_tool_done");
503-
if (fs.existsSync(marker)) {
504-
this.$logger.info("DotNetBridge publish marker found; skipping dotnet-tool");
503+
const arch = process.arch === "arm64" ? "arm64" : "x64";
504+
const exeCandidates = [
505+
process.env.DOTNET_TOOL_PATH,
506+
path.join(platformData.projectRoot, "tools", `dotnet-tool-${arch}.exe`),
507+
path.join(platformData.projectRoot, "tools", "dotnet-tool.exe"),
508+
].filter(Boolean as any);
509+
let exePath: string | null = null;
510+
for (const p of exeCandidates) {
511+
if (p && fs.existsSync(p)) { exePath = p as string; break; }
505512
}
506-
else {
507-
const arch = process.arch === "arm64" ? "arm64" : "x64";
508-
const exeCandidates = [
509-
process.env.DOTNET_TOOL_PATH,
510-
path.join(platformData.projectRoot, "tools", `dotnet-tool-${arch}.exe`),
511-
path.join(platformData.projectRoot, "tools", "dotnet-tool.exe"),
512-
].filter(Boolean as any);
513-
let exePath: string | null = null;
514-
for (const p of exeCandidates) {
515-
if (p && fs.existsSync(p)) { exePath = p as string; break; }
516-
}
517-
if (exePath) {
518-
this.$logger.info(`Running dotnet-tool: ${exePath}`);
519-
try {
520-
521-
const result = await this.$childProcess.spawnFromEvent(exePath, ["--app-root", platformData.projectRoot, "--dir", "app", "--force"], "close", { cwd: platformData.projectRoot }, { throwError: false });
522-
if (result && result.stdout) { this.$logger.info(result.stdout); }
523-
}
524-
catch (err) {
525-
this.$logger.warn(`dotnet-tool execution failed: ${err}`);
526-
}
527-
528-
// Ensure sentinel exists: if publish/ contains DotNetBridge.dll, write marker so MSBuild waits succeed
529-
try {
530-
const markerPath = path.join(appProjectDir, "dotnet-bridge", "publish", ".dotnet_tool_done");
531-
if (!fs.existsSync(markerPath)) {
532-
const publishDir = path.join(appProjectDir, "dotnet-bridge", "publish");
533-
if (fs.existsSync(publishDir)) {
534-
const files = fs.readdirSync(publishDir);
535-
if (files && files.length > 0) {
536-
const bridgeDll = path.join(publishDir, "DotNetBridge.dll");
537-
if (fs.existsSync(bridgeDll)) {
538-
try {
539-
fs.writeFileSync(markerPath, "done", "utf8");
540-
this.$logger.info(`Created dotnet-tool marker at ${markerPath}`);
541-
}
542-
catch (werr) {
543-
this.$logger.warn(`Failed creating dotnet-tool marker: ${werr}`);
544-
}
545-
}
546-
else {
547-
this.$logger.info(`[NativeScript] publish directory exists but DotNetBridge.dll missing; files=${files.join(',')}`);
548-
}
549-
}
550-
}
551-
else {
552-
this.$logger.info(`[NativeScript] publish directory not found at ${publishDir}`);
553-
}
554-
}
555-
}
556-
catch (e) {
557-
this.$logger.warn(`dotnet-tool sentinel check failed: ${e}`);
558-
}
559-
}
513+
if (exePath) {
514+
this.$logger.info(`Running dotnet-tool: ${exePath}`);
515+
const result = await this.$childProcess.spawnFromEvent(exePath, ["--app-root", platformData.projectRoot, "--dir", "app", "--force"], "close", { cwd: platformData.projectRoot }, { throwError: false });
516+
if (result && result.stdout) { this.$logger.info(result.stdout); }
560517
}
561518
}
562519
catch (err) {
563-
this.$logger.warn(`dotnet-tool check failed: ${err}`);
520+
this.$logger.warn(`dotnet-tool execution failed: ${err}`);
564521
}
565522

566523
// Source protection: seal the just-written webpack output (app/) into an encrypted

0 commit comments

Comments
 (0)