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

macOS InvalidProjectFileException Xamarin.Forms Android and iOS projects #1560

Open
1 task
davidortinau opened this issue May 29, 2024 · 1 comment
Open
1 task

Comments

@davidortinau
Copy link

davidortinau commented May 29, 2024

Describe the bug

I'm able to upgrade a Xamarin.Forms library project, but the Android and iOS "head" projects both fail with similar errors.

I'm running this command and selecting the different projects interactively:

upgrade-assistant upgrade --operation Inplace --targetFramework net8.0

The error:

Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/usr/local/share/dotnet/sdk/8.0.204/Xamarin/Android/Xamarin.Android.CSharp.targets" was not
found. Confirm that the expression in the Import declaration "/usr/local/share/dotnet/sdk/8.0.204/Xamarin/Android/Xamarin.Android.CSharp.targets" is correct, and that the
file exists on disk.  /Users/davidortinau/work/ToUpgrade/Xappy/Xappy/Xappy.Android/Xappy.Android.csproj
   at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[]
args)
   at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1,T2](Boolean condition, String errorSubCategoryResourceName, IElementLocation elementLocation,
String resourceName, T1 arg0, T2 arg1)
   at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1,T2](IElementLocation elementLocation, String resourceName, T1 arg0, T2 arg1)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpression(String directoryOfImportingFile, ProjectImportElement importElement, String
unescapedExpression, Boolean throwOnFileNotExistsError, List`1& imports)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement
importElement, List`1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount,
PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase
projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean
interactive)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext
evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext
evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext)
  • Include the log file upgrade-assistant.clef that is produced in the working directory

I don't have such a file.

A clear and concise description of what the bug is.

To Reproduce

The project I'm upgrading is [email protected]:davidortinau/Xappy.git

I had better luck from Windows with the VS Extension

Further technical details

macOS 14.5

  • Include the output of dotnet --list-sdks

8.0.204 [/usr/local/share/dotnet/sdk]
9.0.100-preview.4.24265.4 [/usr/local/share/dotnet/sdk]

  • Include the output of upgrade-assistant --version

0.5.651

@mgoertz-msft
Copy link
Contributor

The imported project "/usr/local/share/dotnet/sdk/8.0.204/Xamarin/Android/Xamarin.Android.CSharp.targets" was not
found.

@davidortinau Do you have that file there? Could the Android/iOS workloads be missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants