[wix-devs] WixToolset.Dnc.HostGenerator errors
Rob Mensching
rob at firegiant.com
Thu Jul 14 16:57:43 PDT 2022
My hypothesis about the item metadata being different does NOT look correct. Items are exactly the same and duplicated and it appears all Analyzer may be duplicated now.
I worked around this issue locally by adding the following target. Since CI is passing, I'll keep this change local as I don't think this is the correct fix (assuming the issue isn't localized to my computer).
<Target Name="RemoveDuplicatesFromAnalyzerItemGroup" AfterTargets="ResolveProjectReferences">
<RemoveDuplicates Inputs="@(Analyzer)">
<Output TaskParameter="Filtered" ItemName="NonDuplicatedAnalyzer" />
</RemoveDuplicates>
<ItemGroup>
<Analyzer Remove="@(Analyzer)" />
<Analyzer Include="@(NonDuplicatedAnalyzer)" />
</ItemGroup>
</Target>
-----Original Message-----
From: wix-devs <wix-devs-bounces at lists.wixtoolset.org> On Behalf Of Rob Mensching via wix-devs
Sent: Thursday, July 14, 2022 4:20 PM
To: WiX Toolset Developer Mailing List <wix-devs at lists.wixtoolset.org>
Cc: Rob Mensching <rob at firegiant.com>
Subject: Re: [wix-devs] WixToolset.Dnc.HostGenerator errors
You are correct the issue is that "WixToolset.Dnc.HostGenerator.dll" is duplicated in the Analyzer item group.
I think I just tracked down the duplication to a WPF's "GenerateTemporaryTargetAssembly" target executing the DncBA.targets "ResolveProjectReferences" target a second time (which adds the output of "WixToolset.Dnc.HostGenerator.csproj" to the Analyzer item group a second time).
I'm guessing the item metadata is different causing the duplication where before the item metadata was the same so no duplicate was added... still digging.
I have .NET SDK 6.0.302 so maybe there is a subtle change in there.
-----Original Message-----
From: wix-devs <wix-devs-bounces at lists.wixtoolset.org> On Behalf Of Sean Hall via wix-devs
Sent: Thursday, July 14, 2022 4:10 PM
To: WiX Toolset Developer Mailing List <wix-devs at lists.wixtoolset.org>
Cc: Sean Hall <r.sean.hall at gmail.com>
Subject: Re: [wix-devs] WixToolset.Dnc.HostGenerator errors
Any luck? I've never seen this. I currently have .NET SDK 6.0.301 and
VS2022 17.2.5.
After some searching, the only thing I found was at https://andrewlock.net/creating-a-source-generator-part-6-saving-source-generator-output-in-source-control/.
Where the project needed two properties together, though it would only occur after the first time it's built:
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
The source generator itself is super simple. It shouldn't be possible to output the generated code twice like it appears to be doing from your errors. I probably need to add a diagnostic when there's multiple attributes defined, but currently it would only use the first one it finds.
The only other way I can imagine what happened here is if there were some kind of bug causing Roslyn to run our generator twice.
On Thu, Jul 14, 2022 at 10:53 AM Sean Hall <r.sean.hall at gmail.com> wrote:
> You can get the files to be written to disk by adding this to the
> project consuming the generator (D:\src\wix4\src\test\burn\WixToolset.WixBA):
>
> <PropertyGroup>
> <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
> </PropertyGroup>
>
> It seems like the generator is running twice for some reason.
>
> On Thu, Jul 14, 2022 at 10:48 AM Rob Mensching via wix-devs <
> wix-devs at lists.wixtoolset.org> wrote:
>
>> I just started getting these sorts of errors in my local build (not
>> showing up in CI):
>>
>> D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.DncHostGenerator\WixToolset.Dnc.Host.g.cs(31,25):
>> error CS0101: The namespace 'WixToolset.Dnc.Host' already contains a
>> definition for 'BootstrapperApplicationFactory'
>> [D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.WixBA_jxw0bnr2
>> _wpftmp.csproj]
>> D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.DncHostGenerator\WixToolset.Dnc.Host.g.cs(24,46):
>> error CS0101: The namespace 'WixToolset.Dnc.Host' already contains a
>> definition for 'StaticEntryDelegate'
>> [D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.WixBA_jxw0bnr2
>> _wpftmp.csproj]
>> D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.DncHostGenerator\WixToolset.Dnc.Host.g.cs(29,6):
>> error CS0579: Duplicate 'GeneratedCode' attribute
>> [D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.WixBA_jxw0bnr2
>> _wpftmp.csproj]
>> D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.DncHostGenerator\WixToolset.Dnc.Host.g.cs(30,6):
>> error CS0579: Duplicate 'CompilerGenerated' attribute
>> [D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.WixBA_jxw0bnr2
>> _wpftmp.csproj]
>> D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.DncHostGenerator\WixToolset.Dnc.Host.g.cs(38,21):
>> error CS0111: Type 'BootstrapperApplicationFactory' already defines a
>> member called 'Create' with the same parameter types
>> [D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.WixBA_jxw0bnr2
>> _wpftmp.csproj]
>> D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.DncHostGenerator\WixToolset.Dnc.Host.g.cs(45,55):
>> error CS0111: Type 'BootstrapperApplicationFactory' already defines a
>> member called 'CreateBAFactory' with the same parameter types
>> [D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.WixBA_jxw0bnr2
>> _wpftmp.csproj]
>> D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.DncHostGenerator\WixToolset.Dnc.Host.g.cs(59,28):
>> error CS0111: Type 'BootstrapperApplicationFactory' already defines a
>> member called 'ModuleInitialize' with the same parameter types
>> [D:\src\wix4\src\test\burn\WixToolset.WixBA\WixToolset.WixBA_jxw0bnr2
>> _wpftmp.csproj]
>>
>> What should I start looking at to diagnose what is going wrong? The
>> .g.cs files mentioned in the error messages do not exist.
>>
>>
>> Regards,
>>
>> Rob Mensching
>> CEO
>> FireGiant
>> _______________________________________________________________
>> FireGiant | Dedicated support for the WiX toolset |
>> http://www.firegiant.com/
>>
>> ____________________________________________________________________
>> WiX Toolset Developer Mailing List provided by FireGiant
>> http://www.firegiant.com/
>>
>
____________________________________________________________________
WiX Toolset Developer Mailing List provided by FireGiant http://www.firegiant.com/ ____________________________________________________________________
WiX Toolset Developer Mailing List provided by FireGiant http://www.firegiant.com/
More information about the wix-devs
mailing list