'WIX merge c++ runtime

I have merged msm for vs 2015 crt:

<DirectoryRef Id="TARGETDIR" >
<Merge Id = "Microsoft_VC140_CRT_x64.msm" FileCompression = "yes" Language = "1033" SourceFile = "..\\..\\..\\..\\..\\..\\..\\external\\tools\\systemsetups\\merge_modules\\Microsoft_VC140_CRT_x64.msm" DiskId = "1" />"
</DirectoryRef>
<Feature>
<Feature Id="Complete" Title="Complete" Absent="allow" Level="1">
...
<MergeRef Id="Microsoft_VC140_CRT_x64.msm"/>
...
</Feature> 

but I still receiving:

---------------------------
MyApp.exe - System Error
---------------------------
The program can't start because mfc140u.dll is missing from your computer. Try reinstalling the program to fix this problem. 
---------------------------
OK   
---------------------------

Any ideas how to merge it properly?



Solution 1:[1]

I gave your UICollectionView a background of orange and ran your code and got similar results:

UICollectionView Rotation UICollectionViewCompositionalLayout

I noticed few things

  1. From this I could conclude the UICollectionView seems to be set up and working well on rotation, probably due to auto layout so I feel the issue is more to do with the layout code.
  2. I also noticed when you start scrolling, the View fixes itself to what you want
  3. Finally, I added one line of code to your func relayoutCollectionView(with size: CGSize) function to see what the dimensions are when you want update the layout calculations and columns
func relayoutCollectionView(with size: CGSize) {
    collectionView.collectionViewLayout.shouldInvalidateLayout(forBoundsChange: CGRect(x: 0,
                                                                                       y: 0,
                                                                                       width: size.width,
                                                                                       height: size.height))
    collectionView.setCollectionViewLayout(createFlowLayout(),
                                           animated: true,
                                           completion: nil)
    
    collectionView.collectionViewLayout.invalidateLayout()
    
    // I added this line
    print("Collection View Width: \(collectionView.frame.size.width), Collection View Height: \(collectionView.frame.size.height)")
}

When I turned from portrait to landscape, the output printed was Collection View Width: 810.0, Collection View Height: 1080.0 which does not seem to be right.

So from this I assume that it is too early for invalidateLayout to be called to get the right calculations.

When I do something like this from a UIViewController, I will make invalidateLayout() call from viewWillLayoutSubviews()

In your case, what I tried and worked was adding the similar override func layoutSubviews() in your class CollectionView: UIView

    override func layoutSubviews() {
        super.layoutSubviews()
        collectionView.collectionViewLayout.invalidateLayout()
    }

I removed relayoutCollectionView from your func relayoutCollectionView

Now it seems to work for the first time as well although I can still not explain why your current works every other time except for the first time.

Solution 2:[2]

Just as top answer say, it will rotaion to wrong layout after scroll collection. I try to set animated to false, it work! But I can't explain why.

    collectionView.setCollectionViewLayout(createFlowLayout(), animated: false, completion: nil)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shawn Frank
Solution 2 Leo Chen