Closed arturl closed 3 weeks ago
Thank you for reporting this, @arturl. With the following simple .csproj, dotnet restore
succeeds:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Pulumi" Version="3.*" />
<PackageReference Include="Pulumi.AzureNative" Version="2.44.1" />
</ItemGroup>
</Project>
Are you able to share your .csproj/project file?
Thanks @thomas11!
Your project worked for me. I think the issue is in the generated project (generated by Pulumi new project wizard) that looks like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Pulumi" Version="3.*" />
<PackageReference Include="Pulumi.AzureNative.Resources" Version="*" />
<PackageReference Include="Pulumi.AzureNative.Web" Version="*" />
<PackageReference Include="Pulumi.AzureNative.Web.Inputs" Version="*" />
</ItemGroup>
</Project>
Now that I'm past that error, I see a couple of other issues in the generated code (like missing using System.Collections.Generic
). Should I open an issue in another repo? Which one is it?
Do you mean this by new project wizard? If so, can file a bug there about the malformed template? These Pulumi.AzureNative.X
packages don't exist.
I'm surprised though because I assumed it would use the same template than pulumi new azure-csharp
. I just tested the latter and it generates a correct project. What exactly did you choose in the new project wizard?
Correction (sorry). The program was created from Pulumi AI. Exact steps:
pulumi new https://www.pulumi.com/ai/api/project/0f4666b3-68fe-4497-a2ac-97ff443bbcd3.zip -s arturl/valuable-osmium-cockatrice/dev
After this, pulumi up
will fail with error NU1101: Unable to find package Pulumi.AzureNative.Resources
I think the project template needs to be updated. You can find file here: https://www.pulumi.com/ai/api/project/d4772a83-184b-44b5-b023-57fe41c06131.zip
I have a PR to fix this.
Fix merged. There might be some weird behavior still with strangely formatted providers, but for Pulumi.AzureNative it should work now.
What happened?
I created a new Pulumi project and downloaded the C# project, tried to compile. There appears to be a missing dependency in Pulumi.AzureNative (see log below).
Example
PM> NuGet\Install-Package Pulumi.AzureNative -Version 2.44.1 Restoring packages for C:\test\pink\pink-potato\pink-potato.csproj... GET https://api.nuget.org/v3-flatcontainer/pulumi.azurenative.resources/index.json GET https://api.nuget.org/v3-flatcontainer/pulumi.azurenative.web/index.json GET https://api.nuget.org/v3-flatcontainer/pulumi/index.json GET https://api.nuget.org/v3-flatcontainer/pulumi.azurenative.web.inputs/index.json NotFound https://api.nuget.org/v3-flatcontainer/pulumi.azurenative.web.inputs/index.json 158ms NotFound https://api.nuget.org/v3-flatcontainer/pulumi.azurenative.resources/index.json 161ms NotFound https://api.nuget.org/v3-flatcontainer/pulumi.azurenative.web/index.json 182ms OK https://api.nuget.org/v3-flatcontainer/pulumi/index.json 246ms CACHE https://api.nuget.org/v3/vulnerabilities/index.json CACHE https://api.nuget.org/v3-vulnerabilities/2024.06.05.23.37.01/vulnerability.base.json CACHE https://api.nuget.org/v3-vulnerabilities/2024.06.05.23.37.01/2024.06.07.11.37.04/vulnerability.update.json NuGet\Install-Package : NU1101: Unable to find package Pulumi.AzureNative.Resources. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org At line:1 char:1
NuGet\Install-Package : NU1101: Unable to find package Pulumi.AzureNative.Web. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org At line:1 char:1 ...
Output of
pulumi about
C:\test\pink\pink-potato pulumi about running 'dotnet build -nologo .' Determining projects to restore...
C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Resources. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org
C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Web. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Web.Inputs. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org
Failed to restore C:\test\pink\pink-potato\pink-potato.csproj (in 468 ms).
Build FAILED.
C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Resources. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Web. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Web.Inputs. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org 0 Warning(s) 3 Error(s)
Time Elapsed 00:00:00.87
Determining projects to restore...
C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Resources. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org
C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Web. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org
C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Web.Inputs. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org
Failed to restore C:\test\pink\pink-potato\pink-potato.csproj (in 468 ms).
Build FAILED.
C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Resources. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org
C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Web. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org
C:\test\pink\pink-potato\pink-potato.csproj : error NU1101: Unable to find package Pulumi.AzureNative.Web.Inputs. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org
Time Elapsed 00:00:00.87
CLI Version 3.119.0 Go Version go1.22.3 Go Compiler gc
Host OS Microsoft Windows 11 Pro Version 10.0.22631 Build 22631 Arch x86_64
This project is written in dotnet: executable='C:\Program Files\dotnet\dotnet.exe' version='8.0.300'
Current Stack: arturl/pink-potato/dev
TYPE URN pulumi:pulumi:Stack urn:pulumi:dev::pink-potato::pulumi:pulumi:Stack::pink-potato-dev
Found no pending operations associated with dev
Backend Name pulumi.com URL https://app.pulumi.com/arturl User arturl Organizations arturl, migrate-to-pulumi-from-tf-20240521 Token type personal
Dependencies: NAME VERSION Pulumi 3.63.1
Pulumi locates its logs in C:\Users\laksb\AppData\Local\Temp by default warning: Failed to get information about the plugin: failed to discover plugin requirements: 'dotnet build -nologo .' exited with non-zero exit code: 1
Additional context
The same issue reproduced with earlier versions of the package, so unlikely to be a regression.
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).