Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulumi version in generated csproj file incorrect #130

Closed
pierskarsenbarg opened this issue Mar 26, 2024 · 1 comment · Fixed by #134
Closed

Pulumi version in generated csproj file incorrect #130

pierskarsenbarg opened this issue Mar 26, 2024 · 1 comment · Fixed by #134
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@pierskarsenbarg
Copy link
Member

pierskarsenbarg commented Mar 26, 2024

What happened?

Reproducing this issue: #43

In the csproj file, the following is the package reference for the Pulumi SDK:

<PackageReference Include="Pulumi" Version="(3.54.1.0,4)" />

Running dotnet build causes this error:

MSBuild version 17.9.4+90725d08d for .NET
  Determining projects to restore...
/Users/piers/go/src/github.com/pierskarsenbarg/scratchpad/crd-csharp/dotnet/Pulumi.Crds.csproj : warning NU1604: Project dependency Pulumi (> 3.54.1 && < 4.0.0) does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
/Users/piers/go/src/github.com/pierskarsenbarg/scratchpad/crd-csharp/dotnet/Pulumi.Crds.csproj : error NU1605: Warning As Error: Detected package downgrade: Pulumi from 3.55.1 to 3.55.0. Reference the package directly from the project to select a different version. 
/Users/piers/go/src/github.com/pierskarsenbarg/scratchpad/crd-csharp/dotnet/Pulumi.Crds.csproj : error NU1605:  Pulumi.Crds -> Pulumi.Kubernetes 3.30.2 -> Pulumi (>= 3.55.1) 
/Users/piers/go/src/github.com/pierskarsenbarg/scratchpad/crd-csharp/dotnet/Pulumi.Crds.csproj : error NU1605:  Pulumi.Crds -> Pulumi (> 3.54.1 && < 4.0.0)
  Failed to restore /Users/piers/go/src/github.com/pierskarsenbarg/scratchpad/crd-csharp/dotnet/Pulumi.Crds.csproj (in 1.24 sec).

Build FAILED.

/Users/piers/go/src/github.com/pierskarsenbarg/scratchpad/crd-csharp/dotnet/Pulumi.Crds.csproj : warning NU1604: Project dependency Pulumi (> 3.54.1 && < 4.0.0) does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
/Users/piers/go/src/github.com/pierskarsenbarg/scratchpad/crd-csharp/dotnet/Pulumi.Crds.csproj : error NU1605: Warning As Error: Detected package downgrade: Pulumi from 3.55.1 to 3.55.0. Reference the package directly from the project to select a different version. 
/Users/piers/go/src/github.com/pierskarsenbarg/scratchpad/crd-csharp/dotnet/Pulumi.Crds.csproj : error NU1605:  Pulumi.Crds -> Pulumi.Kubernetes 3.30.2 -> Pulumi (>= 3.55.1) 
/Users/piers/go/src/github.com/pierskarsenbarg/scratchpad/crd-csharp/dotnet/Pulumi.Crds.csproj : error NU1605:  Pulumi.Crds -> Pulumi (> 3.54.1 && < 4.0.0)
    1 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.46

Example

To reproduce:

  1. Create new folder and change to it: mkdir crdtest && cd cdrtest
  2. Run crd2pulumi pointing at this gist (yaml taken from this comment): crd2pulumi --dotnetPath dotnet --dotnet https://gist.githubusercontent.com/pierskarsenbarg/707236cbfd649025494aa010d95ffb93/raw/f5adab7fccd3007ecf21d675033a3c257c42b4fb/crd.yaml
  3. Change to dotnet folder: cd dotnet
  4. Run dotnet build (which will produce an error)
  5. Change this line (47?): <PackageReference Include="Pulumi" Version="(3.54.1.0,4)" /> to <PackageReference Include="Pulumi" Version="3.*" />

Output of pulumi about

CLI          
Version      3.111.1
Go Version   go1.22.1
Go Compiler  gc

Host     
OS       darwin
Version  14.4.1
Arch     arm64

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/pierskarsenbarg
User           pierskarsenbarg
Organizations  pierskarsenbarg, karsenbarg, team-ce, demo
Token type     personal

Additional context

No response

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).

@pierskarsenbarg pierskarsenbarg added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Mar 26, 2024
@rquitales rquitales removed the needs-triage Needs attention from the triage team label Apr 1, 2024
@rquitales
Copy link
Contributor

I believe we'd need to add Pulumi as another dependency here:

pkg.Language["csharp"], err = ijson.RawMessage(map[string]any{
"packageReferences": map[string]string{
"Pulumi.Kubernetes": "3.*",
},
"compatibility": "kubernetes20",
"dictionaryConstructors": true,
"namespaces": namespaces,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants