woodemi / quick_notify

A cross-platform (Android/iOS/Web/Windows/macOS/Linux) notification plugin for Flutter
BSD 3-Clause "New" or "Revised" License
39 stars 16 forks source link

Microsoft.Windows.CppWinRT.props not found #5

Closed UNIcodeX closed 3 years ago

UNIcodeX commented 3 years ago

I'm getting error: ~\Documents\flutter_apps\alert_proj\build\windows\packages\Microsoft.Windows.CppWinRT\build\native\Microsoft.Windows.CppWinRT.props" was not found

After some research, I found that this is apparently something required by nuget, but that you can't just nuget install {...}, and have to use the special developer powershell for VS2019 Community. Trying the command there says that I need to open a project.

Trying to open to the {project_root}\build\windows folder in VS2019 Community, and trying to run the Install-Package command again, gets me the following Install-Package : Project 'Default' is not found..

Please advise.

Sunbreak commented 3 years ago

Could try the example project with Flutter 2.0+? Does it work?

BTW, you'd better install nuget.exe in you PATH

https://github.com/woodemi/quick_notify/blob/2a408366047c0648ca315a78ff660538803b2940/windows/CMakeLists.txt#L9-L20

UNIcodeX commented 3 years ago

The example project will not build either. Nuget is installed on the path via scoop. I also removed that one and tried the choco version.

C:\Users\unicodex>where nuget
C:\ProgramData\chocolatey\bin\nuget.exe

C:\Users\unicodex>nuget
NuGet Version: 5.10.0.7240
...

Flutter doctor

PS C:\Users\unicodex> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 6.3.9600], locale en-US)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.10.0)
[√] IntelliJ IDEA Community Edition (version 2020.2)
[√] VS Code (version 1.57.1)
[√] VS Code, 64-bit edition (version 1.53.2)
[√] Connected device (3 available)

• No issues found!

When attempting to manually run the install commands outlined in the CMAKE, I get the following.

C:\Users\unicodex\Documents\flutter\quicknot>nuget install "Microsoft.Windows.CppWinRT" -Version 2.0.210505.3 -ExcludeVersion -OutputDirectory .\build\windows\packages
Feeds used:

Argument cannot be null or empty
Parameter name: primarySources

C:\Users\unicodex\Documents\flutter\quicknot>nuget install "Microsoft.Toolkit.Uwp.Notifications" -Version 7.0.2 -ExcludeVersion -OutputDirectory ./build/windows/packages
Feeds used:

Argument cannot be null or empty
Parameter name: primarySources

Looks like some nuget parameter named primarySources is missing??

Sunbreak commented 3 years ago

primarySources is a parameter of nuget.exe internal function: https://github.com/NuGet/NuGet.Client/blob/57f92ad62a14bc1958be2c0acfef79fc589774e3/src/NuGet.Core/NuGet.PackageManagement/NuGetPackageManager.cs#L1631-L1659

        public async Task<IEnumerable<NuGetProjectAction>> PreviewInstallPackageAsync(NuGetProject nuGetProject, PackageIdentity packageIdentity,
            ResolutionContext resolutionContext, INuGetProjectContext nuGetProjectContext,
            IEnumerable<SourceRepository> primarySources, IEnumerable<SourceRepository> secondarySources,
            CancellationToken token)
        {
            // ...
            if (primarySources == null)
            {
                throw new ArgumentNullException(nameof(primarySources));
            }

Mine trial:

C:\Users\sunbr\woodemi\quick_notify\example>nuget install "Microsoft.Windows.CppWinRT" -Version 2.0.210505.3 -ExcludeVersion -OutputDirectory ./build/windows/packages
Feeds used:
  C:\Users\sunbr\.nuget\packages\
  https://api.nuget.org/v3/index.json

Package "Microsoft.Windows.CppWinRT.2.0.210505.3" is already installed.

So I guess Feeds used are missing in your environment

Sunbreak commented 3 years ago

You'd better check your config file %UserProfile%\AppData\Roaming\NuGet\NuGet.Config

Mine is

C:\Users\sunbr>type %UserProfile%\AppData\Roaming\NuGet\NuGet.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>
UNIcodeX commented 3 years ago

OK. Thank you for the reply. I'll check this out when I get back in the office on Monday and report back.

UNIcodeX commented 3 years ago

I was able to install those two packages manually after fixing the NuGet.Config file to be like yours. I'm assuming that if I were to have had that already in place, then flutter pub get would have ran the nuget install without issue.

The next thing I ran into is an error MSB8036: The Windows SDK version 10.0.17134.0 (or later) was not found.

As you can see in this image, a later version is installed. I am and have been able to build other packages / plugins without issue.

image

Sunbreak commented 3 years ago

You could download Windows 10 SDK(10.0.17134.0) in the right pannel, at the end of the list

image

UNIcodeX commented 3 years ago

so the "or later" part doesn't matter?

On Mon, Jun 28, 2021 at 5:11 PM Sunbreak @.***> wrote:

You could download Windows 10 SDK(10.0.17134.0) in the right pannel, at the end of the list

[image: image] https://user-images.githubusercontent.com/7928961/123710106-bc45f380-d8a0-11eb-8a18-9e94866c9b63.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/woodemi/quick_notify/issues/5#issuecomment-870079321, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB62P6ULDBOD4M67VE3RAGLTVDXPLANCNFSM47G6OIHQ .

Sunbreak commented 3 years ago

so the "or later" part doesn't matter? On Mon, Jun 28, 2021 at 5:11 PM Sunbreak @.***> wrote: You could download Windows 10 SDK(10.0.17134.0) in the right pannel, at the end of the list [image: image] https://user-images.githubusercontent.com/7928961/123710106-bc45f380-d8a0-11eb-8a18-9e94866c9b63.png — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#5 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB62P6ULDBOD4M67VE3RAGLTVDXPLANCNFSM47G6OIHQ .

Mine is 10.0.19041.0 and it works fine. I've no idea why yours does NOT work. But installing other version does no harm, does it?

UNIcodeX commented 3 years ago

True that it does no harm. Just low on disk space on this machine. I'll figure it out.

On Tue, Jun 29, 2021 at 8:46 AM Sunbreak @.***> wrote:

so the "or later" part doesn't matter? … <#m8117193811782358617> On Mon, Jun 28, 2021 at 5:11 PM Sunbreak @.***> wrote: You could download Windows 10 SDK(10.0.17134.0) in the right pannel, at the end of the list [image: image] https://user-images.githubusercontent.com/7928961/123710106-bc45f380-d8a0-11eb-8a18-9e94866c9b63.png — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#5 (comment) https://github.com/woodemi/quick_notify/issues/5#issuecomment-870079321>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB62P6ULDBOD4M67VE3RAGLTVDXPLANCNFSM47G6OIHQ .

Mine is 10.0.19041.0 and it works fine. I've no idea why yours does NOT work. But installing other version does no harm, does it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/woodemi/quick_notify/issues/5#issuecomment-870614576, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB62P6RMNGJ3SVI6SJQHRF3TVHFCXANCNFSM47G6OIHQ .

UNIcodeX commented 3 years ago

I finally got back around to testing this part of the app for Windows. The following worked for me to get the app to build using quick_notify on Windows 10.

scoop install nuget
notepad C:\Users\UNIcodeX\AppData\Roaming\NuGet\NuGet.Config
flutter run -d windows

Is there a way to automate this setup if either: A) nuget is not found, or B) a blank / default nuget config file is found.

Sunbreak commented 3 years ago

A) nuget is not found, or

This may help: https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-powershell#use-the-nugetexe-cli-in-the-console

I offen use Package Manager Console when nuget.exe is missing for pure UWP project

B) a blank / default nuget config file is found.

Sorry, I have no idea

pacoDevelop commented 3 years ago

I installed Nuget with scoop and when I start with windows the following happens.

Windows 10 for development and testing environment.

Flutter version: flutter_windows_2.5.2-stable

NuGet Version: 5.11.0.10

image

Sunbreak commented 3 years ago

It works here

C:\Users\sunbr\woodemi\quick_notify>%flutter-2.5.x% doctor -v
[✓] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.19043.1237], locale en-US)
    • Flutter version 2.5.2 at C:\Users\sunbr\flutter\flutter-2.5.x
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3595343e20 (3 weeks ago), 2021-09-30 12:58:18 -0700
    • Engine revision 6ac856380f
    • Dart version 2.14.3
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.4)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.8.30907.101
    • Windows 10 SDK version 10.0.18362.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[✓] VS Code (version 1.61.1)
    • VS Code at C:\Users\sunbr\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.27.0

[✓] Connected device (1 available)
    • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1237]

! Doctor found issues in 2 categories.
pacoDevelop commented 3 years ago

image

Sunbreak commented 3 years ago

You work on 2.6.0-11.0.pre, not 2.5.2-stable

PS: I suspect you were running on Windows (UWP) (desktop) not Windows (desktop)

PPS: Flutter version 2.6.0-11.pre at C:\Users\... leaked your name if you care

Sunbreak commented 3 years ago

File another issue please