Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Adding CsWinRT projection for C# apps #13913

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
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
14 changes: 10 additions & 4 deletions .ado/jobs/universal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,11 @@

- template: ../templates/apply-published-version-vars.yml

- ${{ if eq(matrix.UseFabric, true) }}:
- template: ../templates/enable-fabric-experimental-feature.yml

- template: ../templates/msbuild-sln.yml
parameters:
solutionDir: vnext
${{ if eq(matrix.UseFabric, true) }}:
solutionName: Microsoft.ReactNative.CppOnly.slnf
solutionName: Microsoft.ReactNative.NewArch.sln
${{ else }}:
solutionName: Microsoft.ReactNative.sln
buildPlatform: ${{ matrix.BuildPlatform }}
Expand Down Expand Up @@ -187,6 +184,15 @@
Microsoft.ReactNative.Managed.UnitTests\**
Mso.UnitTests\**

- ${{ if eq(matrix.UseFabric, true) }}:
- template: ../templates/publish-build-artifacts.yml
parameters:
artifactName: ReactWindowsFabric
buildPlatform: AnyCPU
buildConfiguration: ${{ matrix.BuildConfiguration }}
contents: |
Microsoft.ReactNative.CsWinRT\**

- job: UniversalTest${{ matrix.Name }}
variables:
- template: ../variables/windows.yml
Expand Down
10 changes: 6 additions & 4 deletions .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,11 @@ extends:

- template: .ado/templates/apply-published-version-vars.yml@self

- ${{ if eq(matrix.UseFabric, true) }}:
- template: .ado/templates/enable-fabric-experimental-feature.yml@self

- template: .ado/templates/msbuild-sln.yml@self
parameters:
solutionDir: vnext
${{ if eq(matrix.UseFabric, true) }}:
solutionName: Microsoft.ReactNative.CppOnly.slnf
solutionName: Microsoft.ReactNative.NewArch.sln
${{ else }}:
solutionName: Microsoft.ReactNative.sln
buildPlatform: ${{ matrix.BuildPlatform }}
Expand All @@ -368,6 +365,7 @@ extends:
Microsoft.ReactNative\**
Microsoft.ReactNative.Managed\**
Microsoft.ReactNative.Managed.CodeGen\**
Microsoft.ReactNative.CsWinRT\**

- template: .ado/templates/component-governance.yml@self

Expand Down Expand Up @@ -471,12 +469,16 @@ extends:
configuration: Release
- platform: ARM64
configuration: Release
- platform: AnyCPU
configuration: Release
- platform: x64
configuration: Debug
- platform: x86
configuration: Debug
- platform: ARM64
configuration: Debug
- platform: AnyCPU
configuration: Debug

- template: .ado/templates/prep-and-pack-nuget.yml@self
parameters:
Expand Down
2 changes: 2 additions & 0 deletions .ado/templates/react-native-init-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ steps:
slices:
- platform: ${{ parameters.platform }}
configuration: Release
- platform: AnyCPU
configuration: Release

- ${{ if endsWith(parameters.template, '-app') }}:
- script: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Adding CsWinRT projection for C# apps",
"packageName": "@react-native-windows/cli",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Adding CsWinRT projection for C# apps",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,15 @@ export function isRnwDependencyProject(filePath: string): boolean {

const projectLang = getProjectLanguage(filePath);
if (projectLang === 'cs') {
return importProjectExists(
projectContents,
'Microsoft.ReactNative.Uwp.CSharpLib.targets',
return (
importProjectExists(
projectContents,
'Microsoft.ReactNative.Uwp.CSharpLib.targets',
) ||
importProjectExists(
projectContents,
'Microsoft.ReactNative.Composition.CSharpLib.targets',
)
);
} else if (projectLang === 'cpp') {
return (
Expand Down Expand Up @@ -194,9 +200,15 @@ function isRnwAppProject(filePath: string): boolean {

const projectLang = getProjectLanguage(filePath);
if (projectLang === 'cs') {
return importProjectExists(
projectContents,
'Microsoft.ReactNative.Uwp.CSharpApp.targets',
return (
importProjectExists(
projectContents,
'Microsoft.ReactNative.Uwp.CSharpApp.targets',
) ||
importProjectExists(
projectContents,
'Microsoft.ReactNative.Composition.CSharpApp.targets',
)
);
} else if (projectLang === 'cpp') {
return (
Expand Down Expand Up @@ -348,11 +360,18 @@ export function importProjectExists(
projectContents: Node,
projectName: string,
): boolean {
const nodes = msbuildSelect(
let nodes = msbuildSelect(
`//msbuild:Import[contains(@Project,'${projectName}')]`,
projectContents,
);

if (nodes.length === 0) {
nodes = msbuildSelect(
`//Import[contains(@Project,'${projectName}')]`,
projectContents,
);
}

return nodes.length > 0;
}

Expand Down
58 changes: 4 additions & 54 deletions vnext/Desktop.ABITests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,6 @@
"Microsoft.SourceLink.Common": "1.1.1"
}
},
"Microsoft.Windows.SDK.BuildTools": {
"type": "Transitive",
"resolved": "10.0.22621.756",
"contentHash": "7ZL2sFSioYm1Ry067Kw1hg0SCcW5kuVezC2SwjGbcPE61Nn+gTbH86T73G3LcEOVj0S3IZzNuE/29gZvOLS7VA=="
},
"Microsoft.WindowsAppSDK": {
"type": "Transitive",
"resolved": "1.5.240227000",
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
},
"ReactNative.V8Jsi.Windows": {
"type": "Transitive",
"resolved": "0.71.8",
Expand Down Expand Up @@ -91,7 +78,6 @@
"FollyWin32": "[1.0.0, )",
"Microsoft.JavaScript.Hermes": "[0.1.23, )",
"Microsoft.SourceLink.GitHub": "[1.1.1, )",
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",
"ReactCommon": "[1.0.0, )",
"ReactNative.V8Jsi.Windows": "[0.71.8, )",
"boost": "[1.83.0, )"
Expand All @@ -115,45 +101,9 @@
}
}
},
"native,Version=v0.0/win": {
"Microsoft.WindowsAppSDK": {
"type": "Transitive",
"resolved": "1.5.240227000",
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
}
},
"native,Version=v0.0/win-arm64": {
"Microsoft.WindowsAppSDK": {
"type": "Transitive",
"resolved": "1.5.240227000",
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
}
},
"native,Version=v0.0/win-x64": {
"Microsoft.WindowsAppSDK": {
"type": "Transitive",
"resolved": "1.5.240227000",
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
}
},
"native,Version=v0.0/win-x86": {
"Microsoft.WindowsAppSDK": {
"type": "Transitive",
"resolved": "1.5.240227000",
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
}
}
"native,Version=v0.0/win": {},
"native,Version=v0.0/win-arm64": {},
"native,Version=v0.0/win-x64": {},
"native,Version=v0.0/win-x86": {}
}
}
14 changes: 0 additions & 14 deletions vnext/Desktop.DLL/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,6 @@
"resolved": "1.1.1",
"contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg=="
},
"Microsoft.Windows.SDK.BuildTools": {
"type": "Transitive",
"resolved": "10.0.22621.756",
"contentHash": "7ZL2sFSioYm1Ry067Kw1hg0SCcW5kuVezC2SwjGbcPE61Nn+gTbH86T73G3LcEOVj0S3IZzNuE/29gZvOLS7VA=="
},
"Microsoft.WindowsAppSDK": {
"type": "Transitive",
"resolved": "1.5.240227000",
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
},
"common": {
"type": "Project",
"dependencies": {
Expand Down Expand Up @@ -83,7 +70,6 @@
"FollyWin32": "[1.0.0, )",
"Microsoft.JavaScript.Hermes": "[0.1.23, )",
"Microsoft.SourceLink.GitHub": "[1.1.1, )",
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",
"ReactCommon": "[1.0.0, )",
"ReactNative.V8Jsi.Windows": "[0.71.8, )",
"boost": "[1.83.0, )"
Expand Down
14 changes: 0 additions & 14 deletions vnext/Desktop.IntegrationTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@
"Microsoft.SourceLink.Common": "1.1.1"
}
},
"Microsoft.Windows.SDK.BuildTools": {
"type": "Transitive",
"resolved": "10.0.22621.756",
"contentHash": "7ZL2sFSioYm1Ry067Kw1hg0SCcW5kuVezC2SwjGbcPE61Nn+gTbH86T73G3LcEOVj0S3IZzNuE/29gZvOLS7VA=="
},
"Microsoft.WindowsAppSDK": {
"type": "Transitive",
"resolved": "1.5.240227000",
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
},
"ReactNative.V8Jsi.Windows": {
"type": "Transitive",
"resolved": "0.71.8",
Expand Down Expand Up @@ -92,7 +79,6 @@
"FollyWin32": "[1.0.0, )",
"Microsoft.JavaScript.Hermes": "[0.1.23, )",
"Microsoft.SourceLink.GitHub": "[1.1.1, )",
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",
"ReactCommon": "[1.0.0, )",
"ReactNative.V8Jsi.Windows": "[0.71.8, )",
"boost": "[1.83.0, )"
Expand Down
14 changes: 0 additions & 14 deletions vnext/Desktop.UnitTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@
"Microsoft.SourceLink.Common": "1.1.1"
}
},
"Microsoft.Windows.SDK.BuildTools": {
"type": "Transitive",
"resolved": "10.0.22621.756",
"contentHash": "7ZL2sFSioYm1Ry067Kw1hg0SCcW5kuVezC2SwjGbcPE61Nn+gTbH86T73G3LcEOVj0S3IZzNuE/29gZvOLS7VA=="
},
"Microsoft.WindowsAppSDK": {
"type": "Transitive",
"resolved": "1.5.240227000",
"contentHash": "6rESOsREi8534J7IDpNfFYPvxQaSleXKt4A7ZYPeQyckNMQ0o1W0jZ420bJbEMz9Cw/S/8IbpPftLLZ9w/GTCQ==",
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
},
"ReactNative.V8Jsi.Windows": {
"type": "Transitive",
"resolved": "0.71.8",
Expand Down Expand Up @@ -92,7 +79,6 @@
"FollyWin32": "[1.0.0, )",
"Microsoft.JavaScript.Hermes": "[0.1.23, )",
"Microsoft.SourceLink.GitHub": "[1.1.1, )",
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",
"ReactCommon": "[1.0.0, )",
"ReactNative.V8Jsi.Windows": "[0.71.8, )",
"boost": "[1.83.0, )"
Expand Down
Loading
Loading