I’m having error when deploying nuget package of my web application.
Error message i’m getting is the following:
System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
I have found that error goes away when i exclude quartz.config file from root folder of the application. And the thing is that quartz.config is non-xml file and it is used for third-party library Quartz, which i can’t just change to xml.
So is there any option to tell Octopus to exclude certain .config files from being used for variable replacement?
Or is there maybe some kind of special variable to ignore variable replacement errors similar as it’s possible for config transformation errors?
Sorry you’ve hit this, it’s not one we’ve heard before that I remember.
I think we should probably skip the config file if we can’t parse it and log that it’s been skipped.
Just one more side note to this. It was very hard to figure out where this error actually comes from because error log didn’t mention anything about parsing error on particular quartz.config, instead it just showed last successful info message which seemed very much like action on which subsequent error occurred.
Transforming 'C:\Octopus\Applications\MyApp.Web\1.0.1056_3\Web.config' using 'C:\Octopus\Applications\MyApp.Web\1.0.1056_3\Web.Release.config'.
15:44:26
Error
System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
But as i discovered later - the error actually did not happen when transforming web.config, but it was thrown on parsing next config file instead. So the investigation would be much much faster if log would tell the exact file on which the parsing error occurred.
Has there been any update on this bug? I am having the same issue.
17:09:39 Error | Exception while replacing configuration-variables in: D:\Octopus\Applications\Automation\PingFederateService\2.0.0.2\kp_agent.config
17:09:39 Error | System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
17:09:39 Error | at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
17:09:39 Error | at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
17:09:39 Error | at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
17:09:39 Error | at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
17:09:39 Error | at Calamari.Integration.ConfigurationVariables.ConfigurationVariablesReplacer.ReadXmlDocument(String configurationFilePath) in Y:\work\b1fd300731d5f2fc\source\Calamari\Integration\ConfigurationVariables\ConfigurationVariablesReplacer.cs:line 62
17:09:39 Error | at Calamari.Integration.ConfigurationVariables.ConfigurationVariablesReplacer.ModifyConfigurationFile(String configurationFilePath, VariableDictionary variables) in Y:\work\b1fd300731d5f2fc\source\Calamari\Integration\ConfigurationVariables\ConfigurationVariablesReplacer.cs:line 55
17:09:39 Error | at Calamari.Deployment.Conventions.ConfigurationVariablesConvention.Install(RunningDeployment deployment) in Y:\work\b1fd300731d5f2fc\source\Calamari\Deployment\Conventions\ConfigurationVariablesConvention.cs:line 40
17:09:39 Error | at Calamari.Deployment.ConventionProcessor.RunInstallConventions() in Y:\work\b1fd300731d5f2fc\source\Calamari\Deployment\ConventionProcessor.cs:line 60
17:09:39 Error | at Calamari.Deployment.ConventionProcessor.RunConventions() in Y:\work\b1fd300731d5f2fc\source\Calamari\Deployment\ConventionProcessor.cs:line 28
We added a new system variable, Octopus.Action.Package.IgnoreVariableReplacementErrors, to stop this error from failing a deployment in #1897, this should at least get you past failed deployments due to these XML transformation errors.