WindowsAppSDK-Samples icon indicating copy to clipboard operation
WindowsAppSDK-Samples copied to clipboard

Issue with nuget restore (Unable to load the service index for source ...Reunion.nuget.internal/nuget/v3/index.json)

Open marpe opened this issue 1 year ago • 7 comments

I am receiving these errors when I try to build anything, and I don't know how to fix it.

23:11:04 C:\dev\!tmp\WindowsAppSDK-Samples\Samples\Windowing\cs\cs-winforms-unpackaged  main ≡  ?1
6ms  dotnet build
  Determining projects to restore...
C:\dev\!tmp\WindowsAppSDK-Samples\Samples\Windowing\cs\cs-winforms-unpackaged\winforms_unpackaged_app.csproj : error NU
1301: Unable to load the service index for source https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Pro
ject.Reunion.nuget.internal/nuget/v3/index.json. [C:\dev\!tmp\WindowsAppSDK-Samples\Samples\Windowing\cs\cs-winforms-un
packaged\winforms_unpackaged_app.sln]
  Failed to restore C:\dev\!tmp\WindowsAppSDK-Samples\Samples\Windowing\cs\cs-winforms-unpackaged\winforms_unpackaged_a
  pp.csproj (in 8.27 sec).

Build FAILED.

C:\dev\!tmp\WindowsAppSDK-Samples\Samples\Windowing\cs\cs-winforms-unpackaged\winforms_unpackaged_app.csproj : error NU
1301: Unable to load the service index for source https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Pro
ject.Reunion.nuget.internal/nuget/v3/index.json. [C:\dev\!tmp\WindowsAppSDK-Samples\Samples\Windowing\cs\cs-winforms-un
packaged\winforms_unpackaged_app.sln]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:08.63

marpe avatar Sep 10 '24 21:09 marpe

Looks like someone left a reference to the internal Microsoft Nuget packages (not the public packages). As soon as I opened one of the solutions, it popped a credential dialog to log in to Project.Reunion.nuget.internal

ptorr-msft avatar Sep 11 '24 19:09 ptorr-msft

Are these packages available from another source? How would I go about changing it?

marpe avatar Sep 12 '24 01:09 marpe

Is there a workaround? Is there a known-good commit? This is a terrible first experience with the Windows App SDK.

ncalexan avatar Sep 12 '24 19:09 ncalexan

I find getting started with development for win very confusing. are these the samples that are up to date? or am i looking at something that's been deprecated?

and there are a million different entry points, win32, forms, wpf, uwp, app sdk, winui, maui, blazor, webview2 / react native for windows, windows-rs, oh and by the way here's CommunityToolkit and over here's 2000 different Microsoft.Extensions packages... oh ... ok? what's best practice and what's legacy?

I was looking at PowerToys, but it kind of seems like a hodgepodge of different project setups... no clue what style I should be working towards.

Still getting the same error when trying to restore packages for the latest updated sample (👋 @SreejaBhattacharya-MSFT)

PS C:\dev\!tmp\WindowsAppSDK-Samples\Samples\Input\cs-winui> dotnet restore
    C:\dev\!tmp\WindowsAppSDK-Samples\Samples\Input\cs-winui\Input.csproj : error NU1301: Unable to load the service index for source https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json.

Restore failed with 1 error(s) in 8.5s

marpe avatar Sep 20 '24 05:09 marpe

The project can be easily run by removing this line in "WindowsAppSDK-Samples/Samples/nuget.config".

--<add key="ProjectReunion internal" value="https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json" />

WHYBBE avatar Sep 25 '24 01:09 WHYBBE

The project can be easily run by removing this line in "WindowsAppSDK-Samples/Samples/nuget.config".

--<add key="ProjectReunion internal" value="https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json" />

Ok, so I removed the line, tried to build and received this:

image

Pressing YES took me a to a download page for Windows App SDK, which I downloaded and ran (which flashed a window open that I couldn't see wtf it said) so I ran it using pwsh:

04:15:33 ~\Downloads
7ms  & '.\windowsappruntimeinstall-x64 (1).exe'
INFO: Provisioning of WindowsAppSDK packages will be skipped as it requires elevation.
Installing license: MSIX_MAINPACKAGE_LICENSE
Install License result : 0x0
Installing license: MSIX_SINGLETONPACKAGE_LICENSE
Install License result : 0x0
All install operations successful.

Ahhok, Provisioning of WindowsAppSDK packages will be skipped as it requires elevation. is that required? Should I rerun in an elevated shell?

I have no goddamn clue what it means, but I rerun it in an elevated shell...

Right, let's build that sample, everything's good to go, right? Ofc, same error 🥲 I mean sure, the dialog mentions v1.5, but don't link me to v1.6 then? So off I go and download 1.5.6 (1.5.240802000) and install... same error. Aha, maybe install .NET6? Same error... Aha... maybe change target framework to .NET 8?

image

Ok, after googling, nuke <RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers> and replace with <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>.

Receive same Windows App SDK Runtime error... proceed to download and install every goddamn runtime I can find from v1.4 -> v1.6. Same error.

Notice an option to Upgrade, mkay image

Ok thanks for upgrading to a version that's not supported? image

I mean I understand that it's a skill issue but come one... does it have to be like this?


Edit Managed to get the project to build by updating the project file to:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows10.0.26100</TargetFramework>
    <WindowsSdkPackageVersion>10.0.26100.45</WindowsSdkPackageVersion>
    <UseWindowsForms>true</UseWindowsForms>
    <Platforms>x86;x64;ARM64</Platforms>
    <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
    <WindowsPackageType>None</WindowsPackageType>
    <LangVersion>latest</LangVersion>
    <Nullable>enable</Nullable>
    <EnableMsixTooling>true</EnableMsixTooling>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" />
    <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
  </ItemGroup>
</Project>

Managed to find the TargetFramework version to use by checking Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0, but that can't be the intentional way to go about it I hope... Without <EnableMsixTooling>, I was receiving:

>MrtCore.PriGen.targets(914,5): Error MSB4062 : The "Microsoft.Build.Packaging.Pri.Tasks.ExpandPriContent" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\9.0.100-rc.1.24452.12\Microsoft\VisualStudio\v17.0\AppxPackage\\Microsoft.Build.Packaging.Pri.Tasks.dll. Could not load file or assembly 'C:\Program Files\dotnet\sdk\9.0.100-rc.1.24452.12\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.Build.Packaging.Pri.Tasks.dll'. The system cannot find the path specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
0>------- Finished building project: winforms_unpackaged_app. Succeeded: False. Errors: 1. Warnings: 15

and without <WindowsSdkPackageVersion> I was getting:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error (active)		This version of the Windows App SDK requires Microsoft.Windows.SDK.NET.Ref 10.0.26100.38 or later.
    Please update to .NET SDK 6.0.134, 6.0.426, 8.0.109, 8.0.305 or 8.0.402 (or later).
    Or add a temporary Microsoft.Windows.SDK.NET.Ref reference which can be added with:
        <PropertyGroup>
            <WindowsSdkPackageVersion>10.0.26100.38</WindowsSdkPackageVersion>
        </PropertyGroup>
	winforms_unpackaged_app	C:\Users\marpe\.nuget\packages\microsoft.windowsappsdk\1.6.240829007\buildTransitive\Microsoft.WindowsAppSDK.targets	76		

Don't know what impact adding these properties have but ok, got the project to build.

Click 1 button and poof, crashed without breaking on an exception or anything.

'winforms_unpackaged_app.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.Linq.Expressions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'winforms_unpackaged_app.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.Collections.NonGeneric.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[579956] winforms_unpackaged_app.exe' has exited with code 3762701893 (0xe0464645).

Making progress though 🎉

I guess this issue can be closed, but imho the nuget.config file should be updated so that the internal list isn't default.

marpe avatar Sep 27 '24 03:09 marpe

@marpe You just needed to uncomment the line above see https://github.com/microsoft/WindowsAppSDK-Samples/commit/b73d7ba99123dee0353d96276063c2b588baa236

https://github.com/microsoft/WindowsAppSDK-Samples/blob/9ffb70963ad091d496f9d9e6cc4fc537b360e4a9/Samples/nuget.config#L12-L16

tom-huntington avatar Nov 01 '24 04:11 tom-huntington