Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Error - Sequence contains more than one matching element #420

Open
DanielHabenicht opened this issue Oct 20, 2021 · 0 comments
Open

Error - Sequence contains more than one matching element #420

DanielHabenicht opened this issue Oct 20, 2021 · 0 comments

Comments

@DanielHabenicht
Copy link

For the following .csproj:

<Project>
    <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
    <PropertyGroup Label="Globals">
        <SccProjectName>SAK</SccProjectName>
        <SccProvider>SAK</SccProvider>
        <SccAuxPath>SAK</SccAuxPath>
        <SccLocalPath>SAK</SccLocalPath>
        <Configurations>Debug;Release;Staging</Configurations>
        <!-- Also I had to manually add the Output Type for this Test Project -->
        <OutputType>Exe</OutputType>
    </PropertyGroup>

    <PropertyGroup>
        <TargetFramework>NET471</TargetFramework>
        <PlatformTarget>x64</PlatformTarget>
        <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
        <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
        <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
    </PropertyGroup>
</Project>

I am getting this error:

System.InvalidOperationException: Sequence contains more than one matching element
   at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at MSBuild.Abstractions.MSBuildHelpers.GetOrCreateTopLevelPropertyGroupWithTFM(IProjectRootElement rootElement) in /_/src/MSBuild.Abstractions/MSBuildHelpers.cs:line 308
   at MSBuild.Conversion.Project.ProjectRootElementExtensionsForConversion.AddGenerateAssemblyInfoAsFalse(IProjectRootElement projectRootElement, ProjectStyle projectStyle) in /_/src/MSBuild.Conversion.Project/ProjectRootElementExtensionsForConversion.cs:line 526
   at MSBuild.Conversion.Project.Converter.ConvertProjectFile() in /_/src/MSBuild.Conversion.Project/Converter.cs:line 37
   at MSBuild.Conversion.Project.Converter.Convert(String outputPath) in /_/src/MSBuild.Conversion.Project/Converter.cs:line 31
   at MSBuild.Conversion.Program.Run(String project, String workspace, String msbuildPath, String tfm, Boolean forceWebConversion, Boolean preview, Boolean diffOnly, Boolean noBackup, Boolean keepCurrentTfms, Boolean update, Boolean mauiConversion) in /_/src/try-convert/Program.cs:line 159

I don't know if some of my coworkers made a mistake 5 years ago by introducing the <TargetFramework>NET471</TargetFramework> in the second <PropertyGroup> but it is resolved by moving it into the first.

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

No branches or pull requests

1 participant