Closed tero-paananen closed 2 years ago
I have same problem with my app that is React Native Windows 0.66.2 UWP C# and Win32 console solution.
There is AppServiceDemo that uses rn-windows 0.66.3
Sorry, this issue should be reported into https://github.com/microsoft/react-native-windows-samples
Sorry, this issue should be reported into https://github.com/microsoft/react-native-windows-samples
https://github.com/microsoft/react-native-windows-samples/issues/586
This is issue of rn-windows and using AppServiceDemo we can reproduce it. I will keep this open here. Close if wanted.
I set same values <TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
into all projects in the example project solution and it builds. I think that there is bug somewhere.
0.66 has this kind of What's New
rn-windows 0.65.x has <TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
value in React Native Managed project
0.66 has <TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
value in React Native Managed project
Hard to say what causes it that different target platform values in same solution brakes the build in 0.66 now. Is this rn-windows 0.66 or even Visual Studio bug?
It's likely this was a bug in the xaml compiler that existed in 18362 but was fixed in 19041
I updated to Visual Studio 16.11.6 but same error exists
It's likely this was a bug in the xaml compiler that existed in 18362 but was fixed in 19041
What do you mean? 0.65 targeting into 18362 works but 0.66 project not anymore if there is any module in the packaging solution that is targeting 18362 (maybe different than 19041).
I haven't found for solution that, except to change all modules (and of course all community modules) to targeting into 19041
@sbanni since this is likely related to packaging, is this something you could take a look?
If I understand this correctly, some of the projects changed to target 19041 but some of the projects are still targeting 18362 and there is an error that the .Package project throws saying that there are two files with the same name but different contents.
I see that the .wapproj is targeting 19041 and the appservicedemo.csproj is targeting 18362.
The .Package project is asking all the referenced projects for its outputs, this seems to include the Microsoft.UI.Xaml.Markup.winmd from the above mentioned versions. Since these are going into the root of the package, the error is valid as you could potentially get the wrong file. The solution as noted above would be to make sure that each project is using the same TPV.
Is there something wrong with this solution that I am missing?
If I understand this correctly, some of the projects changed to target 19041 but some of the projects are still targeting 18362 and there is an error that the .Package project throws saying that there are two files with the same name but different contents.
I see that the .wapproj is targeting 19041 and the appservicedemo.csproj is targeting 18362.
The .Package project is asking all the referenced projects for its outputs, this seems to include the Microsoft.UI.Xaml.Markup.winmd from the above mentioned versions. Since these are going into the root of the package, the error is valid as you could potentially get the wrong file. The solution as noted above would be to make sure that each project is using the same TPV.
Is there something wrong with this solution that I am missing?
This issue exists after updating from React Native Windows 0.62/0.63/0.64/0.65 to 0.66.
If you have package project that builds and then you take some for example React Native Community module in your project that has different TargetPlatformVersion what is in your project, your project does not build anymore. Developers should patch TargetPlatformVersion of that new module.
(Or is there currently even some common property that should take into every 0.66 project from node_modules/react-native-windows/PropertySheets? Then all 0.66 project uses same TargetPlatformVersion)
`This issue exists after updating from React Native Windows 0.62/0.63/0.64/0.65 to 0.66.
I mean that there was no this issue when updating between for example 0.64 to 0.65. This exists now when updating to 0.66
I will try React Native Windows 0.67 soon and test does it has this same build error...
Same build error on React Native Windows 0.67
"react-native": "0.67.0-rc.1",
"react-native-windows": "0.67.0-preview.6",
Severity Code Description Project File Line Suppression State
Error APPX1112 Payload contains two or more files with the same destination path 'Microsoft.UI.Xaml.Markup.winmd', but they have different content. Source files:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\XamlCompiler\Microsoft.UI.Xaml.Markup.winmd
C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.UI.Xaml.Markup.winmd xxx.Package C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets 1946
Any help for that?
This can be easily tested by updating https://github.com/microsoft/react-native-windows-samples/tree/main/samples/AppServiceDemo from 0.64 to 0.66 or 0.67
@asklar This does not appear to be a packaging project issue, what is the story for updating the TPV in the react-native project?
I should try RN Windows 0.68 because this fix may help https://github.com/microsoft/react-native-windows/commit/98e92db5b0c2b4c0af16573f9742ead55317450b
0.68-preview.2 release note https://github.com/microsoft/react-native-windows/releases/tag/react-native-windows_v0.68.0-preview.2
There is at least some changes in Microsoft.UI.Xaml packaging
I encountered this issue, there was a package that had the target version as build 18362. It was a C# package. Changed the target to 19041 and I was able to build.
I encountered this issue, there was a package that had the target version as build 18362. It was a C# package. Changed the target to 19041 and I was able to build.
rn-windows 0.65 that is not mandatory that all modules have to be targeted into same build. If that is current situation developer have to patch all modules he uses to use some same target version. I think that is not wanted solution.
This can be easily tested by updating https://github.com/microsoft/react-native-windows-samples/tree/main/samples/AppServiceDemo from 0.64 to 0.66 or 0.67
@jonthysell is AppServiceDemo in the set of CI tests for testing version updates?
I should try RN Windows 0.68 because this fix may help https://github.com/microsoft/react-native-windows/commit/98e92db5b0c2b4c0af16573f9742ead55317450b
@jonthysell Do you think that will affect Tero's issue?
AppServiceDemo does not have any CI workflows.
The fix in 68 will help with version mismatches if you update your apps / libs to the latest templates.
Upgrading without updating to the latest templates only works within a certain tolerance. The smaller the version difference, and the less you've modified the windows native files, and the less you depend on external modules, the more likely it will just work.
AppServiceDemo, by it's nature, doesn't fall into that category.
I was able to upgrade AppServiceDemo to 0.67 without issue, but it did require more work than just updating package.json. It required creating a new app from the template, and new module library from the template, then going through and making the tweaks to retain the native code additions (the module, registry app, etc). I will have a PR out shortly.
I am not sure is example really fixed. If you add some community module that target platform version is not 10.0.19041.0 example does not build anymore, i think. I have to test that case soon... Is there some difference is included module (with other target platform version) implemented by c# or c++ i am not sure, maybe.
RN-windows 0.66, 0.67, 0.68 has this same issue. I currently use 0.65 with no this kind of issue.
If you add some community module that target platform version is not 10.0.19041.0 example does not build anymore, i think
Some responses to this in the PR thread. If you're extended the sample you'll need to match the way its handling its module references (which may require changes to that module to match the behavior).
Solution for this issue is to tell WindowsTargetPlatformVersion
in ExperimentalFeatures.props
Read more https://microsoft.github.io/react-native-windows/docs/0.64/customizing-sdk-versions
@tero-paananen still facing same issue RN version 0.64.1 please explain in detail thanks
@tero-paananen still facing same issue RN version 0.64.1 please explain in detail thanks
Solution is to force all project in the solution to use same version of target platfrom version for example 10.0.19041.0.
That can be done by ExperimentalFeatures.props and if that is not enough (project does not use that file) for some project config you must change it yourself.
I have these lines in our ExperimantalFeatures.props
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
and i have also note to check file C:\Users\USER\.nuget\packages\microsoft.ui.xaml\VERSION\buildTransitive\Common.targets
to change this line
from
<TargetPath>$(WinMetadataDir)\Microsoft.UI.Xaml.winmd</TargetPath>
to
<TargetPath>Microsoft.UI.Xaml.winmd</TargetPath>
Problem Description
UWP C# + Win32 console app for example AppServiceDemo on
rn-windows 0.66.3
does not build. I get errorPayload contains two or more files with the same destination path 'Microsoft.UI.Xaml.Markup.winmd'
See AppServiceDemo example app ported into 0.66.3 below.
Steps To Reproduce
Use AppServiceDemo and port it into rn-windows 0.66.3 (see ported app zip package below)
Expected Results
No response
CLI version
6.0.0
Environment
Target Platform Version
No response
Target Device(s)
Desktop
Visual Studio Version
Visual Studio 2019 16.11.2
Build Configuration
Debug
Snack, code example, screenshot, or link to a repository
No response