An error occurred while parsing entityname

hi,
  • Remove From My Forums
  • Question

  • hi,

    One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project,

    One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.


    An error occurred while parsing EntityName. Line 4, position 28.

    Hide    

    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
    at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
    at System.Xml.XmlTextReaderImpl.ParseEntityName()
    at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
    at System.Xml.XmlTextReaderImpl.ParseAttributes()
    at System.Xml.XmlTextReaderImpl.ParseElement()
    at System.Xml.XmlTextReaderImpl.ParseElementContent()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.XmlTextReader.Read()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.RealizeMoniker(String moniker)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.get_FileName()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.get_Assembly()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchGeneratedEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetType(String typeName)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.GetType(String typeName)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)


    An error occurred while parsing EntityName. Line 4, position 28.

    Hide    

    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
    at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
    at System.Xml.XmlTextReaderImpl.ParseEntityName()
    at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
    at System.Xml.XmlTextReaderImpl.ParseAttributes()
    at System.Xml.XmlTextReaderImpl.ParseElement()
    at System.Xml.XmlTextReaderImpl.ParseElementContent()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.XmlTextReader.Read()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.RealizeMoniker(String moniker)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.get_FileName()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.get_Assembly()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchGeneratedEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetType(String typeName)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.GetType(String typeName)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)


    An error occurred while parsing EntityName. Line 4, position 28.

    Details    

    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
    at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
    at System.Xml.XmlTextReaderImpl.ParseEntityName()
    at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
    at System.Xml.XmlTextReaderImpl.ParseAttributes()
    at System.Xml.XmlTextReaderImpl.ParseElement()
    at System.Xml.XmlTextReaderImpl.ParseElementContent()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.XmlTextReader.Read()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.RealizeMoniker(String moniker)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.get_FileName()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.get_Assembly()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchGeneratedEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetType(String typeName)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.GetType(String typeName)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)


    An error occurred while parsing EntityName. Line 4, position 28.

    Hide    

    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
    at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
    at System.Xml.XmlTextReaderImpl.ParseEntityName()
    at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
    at System.Xml.XmlTextReaderImpl.ParseAttributes()
    at System.Xml.XmlTextReaderImpl.ParseElement()
    at System.Xml.XmlTextReaderImpl.ParseElementContent()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.XmlTextReader.Read()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.RealizeMoniker(String moniker)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.get_FileName()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GeneratedAssemblyEntry.get_Assembly()
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchGeneratedEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
    at Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetType(String typeName)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.GetType(String typeName)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)

I am reading an XML string with XDocument

XmlReader reader = XmlReader.Create(new StringReader(xmltext));
        reader.Read();
        XDocument xdoc = XDocument.Load(reader);

Then I grab the content of some tags and put them within tags in a different string.
When I try to Load this string in the same way I did with the first, I get an error «An error occurred while parsing EntityName. Line 1, position 344.».

I think it should be parsed correctly since it has beem parsed before so I guess I am missing something here.

I am reading and copying the content of the first XML with (string)i.Element("field").

I am using .net 4

asked Aug 7, 2012 at 9:34

Jenninha's user avatar

3

When I grab the content of the xml that I want to use for building another Xml string I use (string)i.Element("field") and this is converting my Xml into string. My next Xml Parsing does not recognize it as an Element anymore so I solved the problem by not using (string) before I read my element, just i.Element("field") and this works.

answered Aug 7, 2012 at 9:52

Jenninha's user avatar

JenninhaJenninha

1,3372 gold badges20 silver badges42 bronze badges

It sounds like you’ve got something like this:

<OriginalDocument>
    <Foo>A &amp; B</Foo>
</OriginalDocument>

That A &amp; B represents the text A & B. So when you grab the text from the element, you’ll get the string «A & B». If you then use that to build a new element like this:

string foo = "<Foo>" + fooText + "</Foo>";

then you’ll end up with invalid XML like this:

<Foo>A & B</Foo>

Basically, you shouldn’t be constructing XML in text form. It’s not clear what you’re really trying to achieve, but you can copy an element from one place to another pretty easily in XElement form; you shouldn’t need to build a string and then reparse it.

answered Aug 7, 2012 at 10:01

Jon Skeet's user avatar

Jon SkeetJon Skeet

1.4m851 gold badges9045 silver badges9133 bronze badges

So after spending hours on this issue:
it turns out that if you have an ampersand symbol («&») or any other XML escape characters within your xml string, it will always fail will you try read the XML.
TO solve this, replace the special characters with their escaped string format

 YourXmlString = YourXmlString.Replace("'", "&apos;").Replace(""", "&quot;").Replace(">", "&gt;").Replace("<", "&lt;").Replace("&", "&amp;");

answered Nov 1, 2018 at 18:14

DAVID OLASUPO's user avatar

I am using SQL authentication, while creating New-SPWebApplication script, it was working fine some time before, please assist me to dig out the issue.

Issue: A corrupted web application
got created on WFE server, where I have executed the New-SPWebApplication script, but couldn’t able access it and even I cannot see new application in IIS or virtual directory of other WFE servers

Farm configuration: 4 WFE (load balancer), Fast search server, 1 database server (
SQL authentication )

Error: New-SPWebApplication : An error occurred
while parsing EntityName. Line 1, posi

tion 12322.
At E:……SiteSetupwithSQLAuthentication.ps1:21 ch
ar:21
+ new-spwebapplication <<<<  -name $sp_webapp_name -Port $sp_webapp_port -Authe
nticationProvider $as -hostheader $sp_webapp_hostheader -URL $sp_webapp_url -Ap
plicationPool $sp_webapp_apppool -ApplicationPoolAccount $sp_webapp_apppoolacco
unt -AllowAnonymousAccess:$allowAnonymous   -DatabaseName $sp_webapp_databasena
me -DatabaseServer $sp_webapp_databaseserver -DatabaseCredentials $dbcredential
    + CategoryInfo          : InvalidData: (Microsoft.Share…PWebApplication:
   SPCmdletNewSPWebApplication) [New-SPWebApplication], XmlException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPWeb
   Application

web application is configured
———————

Extracted Log file Errors:

S-1-5-21-2105438894-2453371012-1234567890-6985 will not be granted access to the StateService_GUID database because the database is configured to use sql authentication.

App ‘Word Automation Services’: Farm service account has changed, new identity = ‘S-1-5-21-2105438894-2453371012-1234567890-6985’, updating database to grant access

S-1-5-21-2105438894-2453371012-1234567890-6985 will not be granted access to the WordAutomationServices_GUID database because the database is configured to use sql authentication.

S-1-5-21-2105438894-2453371012-1234567890-8373 will not be granted access to the SessionStateService_GUID database because the database is configured to use sql authentication.

Videntityinfo::isFreshToken reported failure.

Granting server state permission for S-1-5-21-2105438894-2453371012-1234567890-6985.
System.Data.SqlClient.SqlException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.   

 at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)   

 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)   

 at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)   

 at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)   

 at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)   

 at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)   

 at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)   

 at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)   

 at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)   

 at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)   

 at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)   

 at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)   

 at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)   

 at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)   

 at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)   

 at System.Data.SqlClient.SqlConnection.Open()   
 at Microsoft.SharePoint.Utilities.SqlSession.OpenConnection()

 System.Xml.XmlException: An error occurred while parsing EntityName. Line 1, position 10819.  

 at System.Xml.XmlTextReaderImpl.Throw(Exception e)   

 at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)   

 at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)   

 at System.Xml.XmlTextReaderImpl.ParseAttributes()   

 at System.Xml.XmlTextReaderImpl.ParseElement() 

How to validate if there users correct and where they are stored?, is there configuration file used?

Please help me.

Hello All,

I have got an exception while parsing an XML string.

Here is the exception

an error occurred while parsing entityname;. line 1

and the XML I have used is as follows ;

<Details CompanyName="Outlook & Outlook Express" ></Details>

The code is given below :

StringReader strRdr = new StringReader(textBox1.Text);
XmlDocument xmlDoc = new XmlDocument();
try
{
    xmlDoc.Load(strRdr);
    XmlNode node = xmlDoc.DocumentElement.SelectSingleNode(@"/Details");
}
catch (Exception Ex)
{
    System.Windows.Forms.MessageBox.Show(Ex.Message.ToString(), "XML Parsing");
}

If someone can help me to solve this issue, that would be great.

Regards
Sebastian

Updated 17-Apr-17 14:04pm


1 solution

Solution 1

It is because of & in the company name. When the string is being loaded in the XMLDocument it throws the error.

You need to encode it before loading it up. Following should do:

StringReader strRdr = new StringReader("<Details CompanyName="Outlook &amp; Outlook Express" ></Details>");

If needed, decode it back when needed.

ubignor

Lurker
Posts: 2
Liked: never
Joined: Aug 05, 2012 5:19 am
Full Name: Keyvan Chamani
Contact:

Error: An error occurred while parsing EntityName. Line 1

Error: An error occurred while parsing EntityName. Line 1, position 38

Dear member

I am using VEEAM v6 patch 3 as backup solution in my site. i have 24 VM in site on 2 ESX host ESXi 5.0.0- 4413..
i have problem with one of machine during of back that you can find it in bellow

«Error: An error occurred while parsing EntityName. Line 1, position 38»

have any one any comment for this error?

i tried this way before:

1. give directiry to job from SAN directly
2. coennect and disconnect host
3. checked VM ID in SQL data base and it is correct.


veremin

Product Manager
Posts: 19894
Liked: 2153 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Error: An error occurred while parsing EntityName. Line

Post

by veremin » May 30, 2013 8:36 am
1 person likes this post

An error occurred while parsing EntityName

This issue usually appears while processing VM with virtual disks located on datastore with ampersand in its name. The only option you have is to rename the corresponding datastore.

VEEAM v6 patch 3

It used to be a known-issue in VB&R 6 version, thus, it’s always recommended to be on the most up-to-date version since numerous improvements have been implemented so far, as well as, a variety of issues, like the aforesaid one, have been addressed.

Thanks.


ubignor

Lurker
Posts: 2
Liked: never
Joined: Aug 05, 2012 5:19 am
Full Name: Keyvan Chamani
Contact:

Re: Error: An error occurred while parsing EntityName. Line

Post

by ubignor » Jun 01, 2013 11:25 am

Thank you so much
It was very helpful and my problem has been solved.

Just one note: I didn’t have «&» on datastore name, but i have it in name of VM folder on datastore. I changed it and problem gone



bburgstaller

Lurker
Posts: 1
Liked: never
Joined: Oct 30, 2016 1:59 pm
Full Name: Benedikt Burgstaller
Contact:

[MERGED] Error: An error occurred while parsing EntityName.

Post

by bburgstaller » Oct 30, 2016 2:05 pm

Hello everyone,

We are currently using B&R 9.5 Beta on a test system. Build number: 9.5.0.554.RC1
Just stumbled over a bug that has been in the software before: veeam-backup-replication-f2/error-an-er … 16761.html
Issue: When trying to backup a VM that has a folder including an ampersand «&» in its configuration (eg. because an ISO image has been mounted as a CD drive), the backup job will stop with the error «An error occurred while parsing EntityName. Line 1…» In our case it was the following folder which was mounted as a cd drive to install Veeam B&R: D:tempBetaVeeamBackup&Replication_9.5.0.554.RC1.iso
Our environment:
Hyper-V host Windows Server 2016
VM to backup also Windows Server 2016
Seems to be an issue with the XML-processing library in use…
Hope this is not a duplicate to a previous message but as Veeam support didn’t know of this issue until last week, I guess it’s new.

Best regards,
Benedikt






While working on packaging some internal .Net libraries for publishing to our internal NuGet server, I encountered the following cryptic error:

D:ProjectsCompanyWeb>nuget pack Web.csproj -Prop Configuration=Release
Attempting to build package from 'Web.csproj'.
Packing files from 'D:ProjectsCompanyWebbinRelease'.
Using 'Web.nuspec' for metadata.
An error occurred while parsing EntityName. Line 10, position 35.

An error occurred while parsing EntityName. Line 10, position 35.

“EntityName”? What?!? Where did that variable or name come from? Checking my NuGet spec file. Everything looks fine.

<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>George Heeres</authors>
    <owners>$author$</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <releaseNotes>Initial release.</releaseNotes>
    <copyright>Copyright 2014</copyright>
    <tags>company web mvc api webapi http json xml javascript</tags>
    <dependencies>
      <dependency id="Castle.Core" version="[3.0.0.4001,4.0)" />
      <dependency id="Castle.Windsor" version="[3.0.0.4001,4.0)" />
      <dependency id="Company.Core" version="(1,)" />
      <dependency id="Company.Logging" version="(1,)" />
      <dependency id="Company.Security" version="(1,)" />
    </dependencies>
  </metadata>
  <files>
    <file src="binRelease-Net45Company.Web.dll" target="libnet45" />
    <file src="binRelease-Net45Company.Web.XML" target="libnet45" />
  </files>
</package>

The NuGet spec allows for variables ($id$, etc.) to be replaced by values defined in our Assembly (typically AssemblyInfo.cs). In our AssemblyInfo.cs file we have the following:

using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Company.Web")]
[assembly: AssemblyDescription("Custom Web, Mvc & Http components, object and extensions.")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("Company")]
[assembly: AssemblyProduct("Company Web Framework")]
[assembly: AssemblyCopyright("Copyright © 2012,2013,2014; Company")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1943f4e9-b0c0-4daf-bd62-27e2e33f9dc0")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")]

Note: The assembly file version (AssemblyFileVersion) is dynamically generated by the build script & tasks.

So can you spot the problem? I’ll give you a hint, it’s in the AssemblyDescription.

The problem is that “&” sign. Because our NuGet file is an XML file, the “&” value must be escaped. The solution is simple:

[assembly: AssemblyDescription("Custom Web, Mvc &amp; Http components, object and extensions.")]

Or optionally, we can leverage the English language and not be lazy…

[assembly: AssemblyDescription("Custom Web, Mvc and Http components, object and extensions.")]

The later solution may be preferrable because the Windows explorer file properties would display “&amp;” instead of “&”. Using “and” would be more agnostic.

Hopefully this post will save you some time!

I’m getting the following error when trying to build an installer…

[START] Electron Winstaller
  electron-windows-installer:main Using Mono: 'mono' +0ms
  electron-windows-installer:main Using Wine: 'wine' +3ms
  electron-windows-installer:main Created NuSpec file:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>wmail</id>
    <title>wmail</title>
    <version>1.2.4</version>
    <authors>Thomas Beverley</authors>
    <owners>Thomas Beverley</owners>
    <iconUrl>https://raw.githubusercontent.com/atom/electron/master/atom/browser/resources/win/atom.ico</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>The missing desktop client for Gmail &amp; Google Inbox</description>
    <copyright>Copyright © 2016 Thomas Beverley</copyright>
  </metadata>
  <files>
    <file src="locales/**" target="lib/net45/locales" />
    <file src="resources/**" target="lib/net45/resources" />
    <file src="*.bin" target="lib/net45" />
    <file src="*.dll" target="lib/net45" />
    <file src="*.pak" target="lib/net45" />
    <file src="Update.exe" target="lib/net45/squirrel.exe" />
    <file src="icudtl.dat" target="lib/net45/icudtl.dat" />
    <file src="LICENSE" target="lib/net45/LICENSE" />
    <file src="wmail.exe" target="lib/net45/wmail.exe" />
  </files>
</package>
 +7s
[Error: Failed with exit code: 1
Output:
Attempting to build package from 'wmail.nuspec'.
An error occurred while parsing EntityName. Line 1, position 39.
]

Понравилась статья? Поделить с друзьями:
  • An error occurred while opening one or more files перевод
  • An error occurred while opening flp file
  • An error occurred while opening a codec sony vegas что делать
  • An error occurred while occurred loading the project file sony vegas
  • An error occurred while making the requested connection перевод