Skip to content

Commit

Permalink
.net projects need more work to build a package layout (#4751)
Browse files Browse the repository at this point in the history
* .net projects need more work to build a package layout

* Change files

* make async
  • Loading branch information
asklar authored and NickGerleman committed May 2, 2020
1 parent 82d017d commit fd42f75
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
8 changes: 8 additions & 0 deletions change/react-native-windows-2020-04-29-18-21-26-4749.json
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": ".net projects need more work to build a package layout",
"packageName": "react-native-windows",
"email": "asklar@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-04-30T01:21:26.428Z"
}
5 changes: 3 additions & 2 deletions vnext/local-cli/runWindows/runWindows.js
Expand Up @@ -25,6 +25,7 @@ function ExitProcessWithError(loggingWasEnabled) {

async function runWindows(config, args, options) {
const verbose = options.logging;

if (verbose) {
newInfo('Verbose: ON');
}
Expand All @@ -47,12 +48,12 @@ async function runWindows(config, args, options) {

// Fix up options
options.root = options.root || process.cwd();
const slnFile = options.sln || build.getSolutionFile(options);

if (options.autolink) {
autolink.updateAutoLink(verbose);
}
if (options.build) {
const slnFile = options.sln || build.getSolutionFile(options);
if (!slnFile) {
newError(
'Visual Studio Solution file not found. Maybe run "react-native windows" first?',
Expand Down Expand Up @@ -101,7 +102,7 @@ async function runWindows(config, args, options) {
if (options.device || options.emulator || options.target) {
await deploy.deployToDevice(options, verbose);
} else {
await deploy.deployToDesktop(options, verbose);
await deploy.deployToDesktop(options, verbose, slnFile);
}
} catch (e) {
newError(`Failed to deploy${e ? `: ${e.message}` : ''}`);
Expand Down
11 changes: 9 additions & 2 deletions vnext/local-cli/runWindows/utils/deploy.js
Expand Up @@ -159,7 +159,13 @@ async function deployToDevice(options, verbose) {
}
}

async function deployToDesktop(options, verbose) {
async function hasDotNetProjects(slnFile) {
const contents = (await fs.promises.readFile(slnFile)).toString();
let r = /\"([^"]+\.(csproj|vbproj))\"/;
return r.test(contents);
}

async function deployToDesktop(options, verbose, slnFile) {
const appPackageFolder = getAppPackage(options);
const windowsStoreAppUtils = getWindowsStoreAppUtils(options);
const appxManifestPath = getAppxManifestPath(options);
Expand Down Expand Up @@ -202,7 +208,8 @@ async function deployToDesktop(options, verbose) {
verbose,
);

if (options.release) {
// #4749 - need to deploy from appx for .net projects.
if (options.release || (await hasDotNetProjects(slnFile))) {
await runPowerShellScriptFunction(
'Installing new version of the app',
windowsStoreAppUtils,
Expand Down

0 comments on commit fd42f75

Please sign in to comment.