{"record":{"id":"d24df22f46ed5b34","repo":"unoplatform/uno","slug":"msbuild-property-msbuildprojectfullpath-value-pr-d24df2","errorCode":null,"errorMessage":"MSBuild property MSBuildProjectFullPath value {_projectFullPath} is not valid","messagePattern":"MSBuild property MSBuildProjectFullPath value (.+?) is not valid","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/DependencyObjectAvailabilityGenerator.cs","lineNumber":64,"sourceCode":"\t\t\t\t\tvar validPlatform = PlatformHelper.IsValidPlatform(context);\n\n\t\t\t\t\tif (!bool.TryParse(context.GetMSBuildPropertyValue(\"UnoXamlResourcesTrimming\"), out _xamlResourcesTrimming))\n\t\t\t\t\t{\n\t\t\t\t\t\t_xamlResourcesTrimming = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!bool.TryParse(context.GetMSBuildPropertyValue(\"_IsUnoUISolution\"), out _isUnoUISolution))\n\t\t\t\t\t{\n\t\t\t\t\t\t_isUnoUISolution = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (validPlatform && (_xamlResourcesTrimming || _isUnoUISolution))\n\t\t\t\t\t{\n\t\t\t\t\t\t_defaultNamespace = context.GetMSBuildPropertyValue(\"RootNamespace\");\n\n\t\t\t\t\t\t_projectFullPath = context.GetMSBuildPropertyValue(\"MSBuildProjectFullPath\");\n\t\t\t\t\t\t_projectDirectory = Path.GetDirectoryName(_projectFullPath)\n\t\t\t\t\t\t\t?? throw new InvalidOperationException($\"MSBuild property MSBuildProjectFullPath value {_projectFullPath} is not valid\");\n\n\t\t\t\t\t\t_ = bool.TryParse(context.GetMSBuildPropertyValue(\"UnoDisableBindableTypeProvidersGeneration\"), out var disableBindableTypeProvidersGeneration);\n\n\t\t\t\t\t\t_intermediateOutputPath = context.GetMSBuildPropertyValue(\"IntermediateOutputPath\");\n\t\t\t\t\t\t_intermediatePath = Path.Combine(\n\t\t\t\t\t\t\t_projectDirectory,\n\t\t\t\t\t\t\t_intermediateOutputPath\n\t\t\t\t\t\t);\n\t\t\t\t\t\t_assemblyName = context.GetMSBuildPropertyValue(\"AssemblyName\");\n\t\t\t\t\t\t_dependencyObjectSymbol = context.Compilation.GetTypeByMetadataName(\"Microsoft.UI.Xaml.DependencyObject\");\n\t\t\t\t\t\t_additionalLinkerHintAttributeSymbol = context.Compilation.GetTypeByMetadataName(\"Uno.Foundation.Diagnostics.CodeAnalysis.AdditionalLinkerHintAttribute\");\n\n\t\t\t\t\t\tvar additionalLinkerHintSymbols = FindAdditionalLinkerHints(context);\n\n\t\t\t\t\t\tvar modules = from ext in context.Compilation.ExternalReferences\n\t\t\t\t\t\t\t\t\t  let sym = context.Compilation.GetAssemblyOrModuleSymbol(ext) as IAssemblySymbol\n\t\t\t\t\t\t\t\t\t  where sym != null\n\t\t\t\t\t\t\t\t\t  from module in sym.Modules","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/DependencyObjectAvailabilityGenerator.cs#L46-L82","documentation":"DependencyObjectAvailabilityGenerator reads MSBuildProjectFullPath to locate the project directory and throws InvalidOperationException when Path.GetDirectoryName returns null (empty/root/unset path). It activates only when validPlatform && (_xamlResourcesTrimming || _isUnoUISolution).","triggerScenarios":"MSBuildProjectFullPath is empty, a drive root, or unset while the generator is active (UnoXamlResourcesTrimming=true or building inside the Uno solution).","commonSituations":"Building with UnoXamlResourcesTrimming enabled through a host that omits MSBuildProjectFullPath; building the Uno solution from a stripped/corrupted project file.","solutions":["Build via MSBuild/dotnet so MSBuildProjectFullPath is defined.","If trimming is not needed locally, disable it (unset UnoXAMLResourcesTrimming / set UnoXamlResourcesTrimming=false).","Verify the .csproj SDK/imports are intact so the path property resolves."],"exampleFix":"# before: trimming on, path missing\ndotnet build -p:UnoXamlResourcesTrimming=true # MSBuildProjectFullPath unset\n# after\ndotnet build /abs/path/to/Project.csproj -p:UnoXamlResourcesTrimming=true","handlingStrategy":"validation","validationCode":"// If you enable trimming or build the Uno solution, ensure the path property is set\nvar path = Environment.GetEnvironmentVariable(\"MSBuildProjectFullPath\");\nif (string.IsNullOrWhiteSpace(path) || System.IO.Path.GetDirectoryName(path) == null)\n    throw new InvalidOperationException(\"MSBuildProjectFullPath unset; build via dotnet/MSBuild or disable UnoXamlResourcesTrimming.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable UnoXamlResourcesTrimming locally if you build outside a full MSBuild host.","Keep .csproj SDK imports intact so MSBuildProjectFullPath resolves."],"tags":["msbuild","source-generator","build-config","project-path","trimming"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}