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

When adding a new page via copy-paste, the csproj adds ItemGroups that makes the new page uncompilable #16605

Open
ArchieCoder opened this issue May 7, 2024 · 7 comments
Assignees
Labels
area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@ArchieCoder
Copy link
Contributor

What would you like clarification on

In this article, it should be mentioned that when adding a new page, the developer needs to manually remove the ItemGroup added in the csproj.

These ItemGroups generate the compilation error "XYZPage does not contain a definition for 'InitializeComponent' and no accessible...

image

Concern

Developing with Uno

Affected platforms

Windows (WinAppSDK)

Any feedback?

No response

@ArchieCoder ArchieCoder added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/documentation triage/untriaged Indicates an issue requires triaging or verification labels May 7, 2024
@Youssef1313 Youssef1313 added area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk kind/bug Something isn't working and removed kind/documentation labels May 7, 2024
@jeromelaban
Copy link
Member

Thanks for the report. This looks similar to dotnet/project-system#7028 (/cc @dansiegel)

@agneszitte
Copy link
Contributor

agneszitte commented May 7, 2024

@jeromelaban, @dansiegel
A couple more details:

@jeromelaban
Copy link
Member

@ArchieCoder I'm not reproducing the output you got when copying the files. Would you have more precise repro steps?

Note that Visual Studio is adding ItemGroups incorrectly for an uno app, and so does a default winui app or with a MAUI app when copying XAML files.

We'll likely need to open an issue VS community site to report it.

@ArchieCoder
Copy link
Contributor Author

@jeromelaban Video of my steps https://github.com/unoplatform/uno/assets/1608424/2011549b-d239-4a0c-bfed-93e0bc191e69

In words:

  • Create new project
  • Copy paste SecondPage.xaml
  • Rename SecondPage in xaml and 2 times in xaml.cs

UnoApp7.csproj.txt

@ArchieCoder
Copy link
Contributor Author

Adding a new UserControl via Add New Item also create noises in csproj

@jeromelaban jeromelaban assigned jeromelaban and unassigned dansiegel May 14, 2024
@jeromelaban
Copy link
Member

The key comment is dotnet/aspnetcore#24790 (comment), where :

To avoid unexpected behavior, VS is trying to avoid including a file multiple times in both None/Content.

It looks like we should be avoiding including files in multiple item groups, but that seems counter inuitive for some scenarios, particularly UpToDateCheckInput.

@jeromelaban
Copy link
Member

It feels like there's something incorrect in VS, let's continue tracking in https://developercommunity.visualstudio.com/t/ItemGroups-are-created-regardless-of-glo/10658677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

5 participants