-
Notifications
You must be signed in to change notification settings - Fork 691
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
[Generation] AdditionalFiles
should not be removed if not added by uno
#8176
Comments
uno/src/SourceGenerators/Uno.UI.SourceGenerators/Content/Uno.UI.SourceGenerators.props Lines 362 to 364 in 2ed9559
The problem is because this code clears the metadata for AdditionalFiles. The fix is either by removing this code (I need to know why the full path is being used) or by moving the metadata on cleanup |
I guess this can be solved with something like <AdditionalFiles>
<Identity>$([System.IO.Path]::GetFullPath('%(AdditionalFiles.Identity)'))</Identity>
</TestItemGroup> But I need to check if this will update the FullPath and other metadata. |
Everything turned out to be not so simple. Even if these three lines are removed, msbuild cannot merge the metadata for AdditionalFiles that were specified with a relative path and the metadata for AdditionalFiles with an absolute path, even if the end result is the same. Only the metadata for the AdditionalFiles that were added last will remain. By testing on a real project with _InjectAdditionalFiles override so far I've come to this solution. I need to look at it with fresh eyes to make sure that everything is normal (this works correctly) <Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk.Web" />
<!-- Project code -->
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.Web" />
<Target Name="_InjectAdditionalFiles" BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun;GenerateMSBuildEditorConfigFileCore" DependsOnTargets="_FillSourceGeneratorItemGroups">
<ItemGroup Label="Include new additional files">
<_ExistingAdditionalFiles Include="%(AdditionalFiles.FullPath)" />
<AdditionalFiles Include="%(Page.FullPath)" SourceItemGroup="Page" Exclude="@(_ExistingAdditionalFiles)" />
<AdditionalFiles Include="%(ApplicationDefinition.FullPath)" SourceItemGroup="ApplicationDefinition" Exclude="@(_ExistingAdditionalFiles)" />
<AdditionalFiles Include="%(PRIResource.FullPath)" SourceItemGroup="PRIResource" Exclude="@(_ExistingAdditionalFiles)" />
<AdditionalFiles Include="%(TSBindingAssemblySource.FullPath)" SourceItemGroup="TSBindingAssemblySource" Exclude="@(_ExistingAdditionalFiles)" />
</ItemGroup>
<PropertyGroup>
<_Pages>@(Page)</_Pages>
<_ApplicationDefinitions>@(ApplicationDefinition)</_ApplicationDefinitions>
<_PRIResources>@(PRIResource)</_PRIResources>
<_TSBindingAssemblySources>@(TSBindingAssemblySource)</_TSBindingAssemblySources>
</PropertyGroup>
<ItemGroup Label="Add SourceItemGroup metadata to existing additional files">
<AdditionalFiles SourceItemGroup="Page" Condition="$([System.String]::new('$(_Pages)').Contains('%(AdditionalFiles.FullPath)'))" />
<AdditionalFiles SourceItemGroup="ApplicationDefinition" Condition="$([System.String]::new('$(_ApplicationDefinitions)').Contains('%(AdditionalFiles.FullPath)'))" />
<AdditionalFiles SourceItemGroup="PRIResource" Condition="$([System.String]::new('$(_PRIResources)').Contains('%(AdditionalFiles.FullPath)'))" />
<AdditionalFiles SourceItemGroup="TSBindingAssemblySource" Condition="$([System.String]::new('$(_TSBindingAssemblySources)').Contains('%(AdditionalFiles.FullPath)'))" />
</ItemGroup>
</Target>
</Project>
|
AdditionalFiles
should not be removed if not added by uno
Discussed in #8175
Originally posted by HavenDV February 23, 2022
I noticed that the Uno package started blocking the use of third-party generators. In my case, I was generating View code behind constructor code in my test project.
Is this a bug or is it a special behavior to limit the possible problems of using other generators in most cases? In second case, just need to create a library that will call these generators and use it already in Uno
I assume it is caused by this code
uno/src/SourceGenerators/Uno.UI.SourceGenerators/Content/Uno.UI.SourceGenerators.props
Lines 362 to 363 in 2ed9559
P.S. I did not find any changes in the code that would explicitly prohibit the use of other generators. But I still can't achieve using another generator in a project with Uno.UI.WebAssembly. This may be related to dotnet updates to 6.0.2 or VS to 17.2 preview
Repro:
ratbuddyssey-master.zip
The text was updated successfully, but these errors were encountered: