Installing a Nuget package I created returns an error "There are multiple root elements. Line 3, position 2."

StackOverflow https://stackoverflow.com/questions/17452717

  •  02-06-2022
  •  | 
  •  

سؤال

I recently created a Nuget package, but when trying to install it, it's returning the error:

There are multiple root elements. Line 3, position 2.

QUESTION: What is this error referencing- the nuspec file? The web.config.transform that I have in my content folder?

Here's my .nuspec file:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id>blah</id>
        <version>1.0.0</version>
        <authors>omitted</authors>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>This package integrates **** functionality into existing Web Forms applications.</description>
        <language>es-US</language>
    </metadata>

</package>

Here's my web.config.transform:

<section name="blah" type="omitted.Security.PasswordManagement.omitted.Configuration.PVSecureConnectionStringsSection, omitted.Security.PasswordManagement.PasswordVault" />

<blah blah="blah">
    <connectionStrings>
      <add name="**NAME**-Local" connectionString="data source=**DB SERVER**;initial catalog=**DATABASE**;user id=**USER ID**;password=**PASSWORD**;" providerName="System.Data.SqlClient" />
      <add name="**NAME**-Development" connectionString="data source=**DB SERVER**;initial catalog=**DATABASE**;user id=**USER ID**;" />
      <add name="**NAME**-Test" connectionString="data source=**DB SERVER**;initial catalog=**DATABASE**;user id=**USER ID**;"  />
      <add name="**NAME**-Production" connectionString="data source=**DB SERVER**;initial catalog=**DATABASE**;user id=**USER ID**;" />
    </connectionStrings>
  </blah>
هل كانت مفيدة؟

المحلول

The error came from my web.config.transform file. I need to only have one root element, even though it's a transform file. So, all I did was add a top level root <configuration> element, and that resolved my problem.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top