Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions change/react-native-windows-2020-04-29-18-21-26-4749.json
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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