diff --git a/pkg/codegen/dotnet/gen.go b/pkg/codegen/dotnet/gen.go index 19a188047fa9..21f09f3391bd 100644 --- a/pkg/codegen/dotnet/gen.go +++ b/pkg/codegen/dotnet/gen.go @@ -2182,9 +2182,25 @@ func genProjectFile(pkg *schema.Package, if packageReferences == nil { packageReferences = map[string]string{} } + + // if we don't have a package reference to Pulumi SDK from nuget + // we need to add it, unless we are referencing a local Pulumi SDK project via a project reference if _, ok := packageReferences["Pulumi"]; !ok { - packageReferences["Pulumi"] = "[3.23.0,4)" + referencedLocalPulumiProject := false + for _, projectReference := range projectReferences { + if strings.HasSuffix(projectReference, "Pulumi.csproj") { + referencedLocalPulumiProject = true + break + } + } + + // only add a package reference to Pulumi if we're not referencing a local Pulumi project + // which we usually do when testing schemas locally + if !referencedLocalPulumiProject { + packageReferences["Pulumi"] = "[3.23.0,4)" + } } + w := &bytes.Buffer{} err := csharpProjectFileTemplate.Execute(w, csharpProjectFileTemplateContext{ XMLDoc: fmt.Sprintf(`.\%s.xml`, assemblyName), diff --git a/pkg/codegen/testing/test/testdata/azure-native-nested-types/dotnet/Pulumi.AzureNative.csproj b/pkg/codegen/testing/test/testdata/azure-native-nested-types/dotnet/Pulumi.AzureNative.csproj index 002e69b30b55..fc3018150069 100644 --- a/pkg/codegen/testing/test/testdata/azure-native-nested-types/dotnet/Pulumi.AzureNative.csproj +++ b/pkg/codegen/testing/test/testdata/azure-native-nested-types/dotnet/Pulumi.AzureNative.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/cyclic-types/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/cyclic-types/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/cyclic-types/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/cyclic-types/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/Pulumi.FooBar.csproj b/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/Pulumi.FooBar.csproj index ccad09387ea3..f43e6a3421e0 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/Pulumi.FooBar.csproj +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/dotnet/Pulumi.FooBar.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/dashed-import-schema/dotnet/Pulumi.Plant.csproj b/pkg/codegen/testing/test/testdata/dashed-import-schema/dotnet/Pulumi.Plant.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/dashed-import-schema/dotnet/Pulumi.Plant.csproj +++ b/pkg/codegen/testing/test/testdata/dashed-import-schema/dotnet/Pulumi.Plant.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/functions-secrets/dotnet/Pulumi.Mypkg.csproj b/pkg/codegen/testing/test/testdata/functions-secrets/dotnet/Pulumi.Mypkg.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/functions-secrets/dotnet/Pulumi.Mypkg.csproj +++ b/pkg/codegen/testing/test/testdata/functions-secrets/dotnet/Pulumi.Mypkg.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/hyphen-url/dotnet/Pulumi.Registrygeoreplication.csproj b/pkg/codegen/testing/test/testdata/hyphen-url/dotnet/Pulumi.Registrygeoreplication.csproj index 88b877c46a12..4c9f1846ae17 100644 --- a/pkg/codegen/testing/test/testdata/hyphen-url/dotnet/Pulumi.Registrygeoreplication.csproj +++ b/pkg/codegen/testing/test/testdata/hyphen-url/dotnet/Pulumi.Registrygeoreplication.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/naming-collisions/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/naming-collisions/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/naming-collisions/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/naming-collisions/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/nested-module-thirdparty/dotnet/Pulumi.FooBar.csproj b/pkg/codegen/testing/test/testdata/nested-module-thirdparty/dotnet/Pulumi.FooBar.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/nested-module-thirdparty/dotnet/Pulumi.FooBar.csproj +++ b/pkg/codegen/testing/test/testdata/nested-module-thirdparty/dotnet/Pulumi.FooBar.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/dotnet/Pulumi.Myedgeorder.csproj b/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/dotnet/Pulumi.Myedgeorder.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/dotnet/Pulumi.Myedgeorder.csproj +++ b/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/dotnet/Pulumi.Myedgeorder.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/dotnet/Pulumi.Mypkg.csproj b/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/dotnet/Pulumi.Mypkg.csproj index 1ba1426ec5d7..ceeb28023321 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/dotnet/Pulumi.Mypkg.csproj +++ b/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/dotnet/Pulumi.Mypkg.csproj @@ -50,7 +50,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/output-funcs/dotnet/Pulumi.Mypkg.csproj b/pkg/codegen/testing/test/testdata/output-funcs/dotnet/Pulumi.Mypkg.csproj index 1ba1426ec5d7..ceeb28023321 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/dotnet/Pulumi.Mypkg.csproj +++ b/pkg/codegen/testing/test/testdata/output-funcs/dotnet/Pulumi.Mypkg.csproj @@ -50,7 +50,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/plain-and-default/dotnet/Pulumi.FooBar.csproj b/pkg/codegen/testing/test/testdata/plain-and-default/dotnet/Pulumi.FooBar.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/plain-and-default/dotnet/Pulumi.FooBar.csproj +++ b/pkg/codegen/testing/test/testdata/plain-and-default/dotnet/Pulumi.FooBar.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/plain-object-defaults/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/plain-object-defaults/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/plain-schema-gh6957/dotnet/Pulumi.Xyz.csproj b/pkg/codegen/testing/test/testdata/plain-schema-gh6957/dotnet/Pulumi.Xyz.csproj index 09ca698d9fee..e6ac8bba8089 100644 --- a/pkg/codegen/testing/test/testdata/plain-schema-gh6957/dotnet/Pulumi.Xyz.csproj +++ b/pkg/codegen/testing/test/testdata/plain-schema-gh6957/dotnet/Pulumi.Xyz.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/regress-8403/dotnet/Pulumi.Mongodbatlas.csproj b/pkg/codegen/testing/test/testdata/regress-8403/dotnet/Pulumi.Mongodbatlas.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/regress-8403/dotnet/Pulumi.Mongodbatlas.csproj +++ b/pkg/codegen/testing/test/testdata/regress-8403/dotnet/Pulumi.Mongodbatlas.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/regress-node-8110/dotnet/Pulumi.My8110.csproj b/pkg/codegen/testing/test/testdata/regress-node-8110/dotnet/Pulumi.My8110.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/regress-node-8110/dotnet/Pulumi.My8110.csproj +++ b/pkg/codegen/testing/test/testdata/regress-node-8110/dotnet/Pulumi.My8110.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/replace-on-change/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/replace-on-change/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/replace-on-change/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/replace-on-change/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/resource-args-python/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/resource-args-python/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/resource-args-python/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/resource-args-python/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/resource-property-overlap/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/resource-property-overlap/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/resource-property-overlap/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/resource-property-overlap/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/secrets/dotnet/Pulumi.Mypkg.csproj b/pkg/codegen/testing/test/testdata/secrets/dotnet/Pulumi.Mypkg.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/secrets/dotnet/Pulumi.Mypkg.csproj +++ b/pkg/codegen/testing/test/testdata/secrets/dotnet/Pulumi.Mypkg.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/simple-enum-schema/dotnet/Pulumi.Plant.csproj b/pkg/codegen/testing/test/testdata/simple-enum-schema/dotnet/Pulumi.Plant.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/simple-enum-schema/dotnet/Pulumi.Plant.csproj +++ b/pkg/codegen/testing/test/testdata/simple-enum-schema/dotnet/Pulumi.Plant.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema-single-value-returns/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/simple-methods-schema-single-value-returns/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema-single-value-returns/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/simple-methods-schema-single-value-returns/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/simple-methods-schema/dotnet/Pulumi.Example.csproj index d0a3cbcf592d..dea2cc23b1dc 100644 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/simple-methods-schema/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/simple-plain-schema/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/simple-plain-schema/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/simple-plain-schema/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/simple-plain-schema/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ - diff --git a/pkg/codegen/testing/test/testdata/simple-resource-schema/dotnet/Pulumi.Example.csproj b/pkg/codegen/testing/test/testdata/simple-resource-schema/dotnet/Pulumi.Example.csproj index 1e7e4bd6ba4f..ced8e3baa5db 100644 --- a/pkg/codegen/testing/test/testdata/simple-resource-schema/dotnet/Pulumi.Example.csproj +++ b/pkg/codegen/testing/test/testdata/simple-resource-schema/dotnet/Pulumi.Example.csproj @@ -45,7 +45,6 @@ -