I have a VB.Net 4.7.2 desktop application that is throwing an exception occasionally. The exception is usually, "Root element is missing".
When this happens, I am able to view the file after the fact and the root element is there.
The file is written to the share by a remote Linux system and is accessed by this application using an SMB share.
I thought there might be a timing issue with the file being written to the share, so I implemented a retry and I still get the same exception after trying 3 times, 10 seconds apart.
The xmlPath is passed in as a parameter.
' xmlPath is the UNC path to a local network share.
Dim xmlDoc As New XmlDocument()
xmlDoc.Load(xmlPath)
When I view the XML file at the file location, here's what I see.
<reportrequest Version="1.0">
<report ReportGUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ReportCode="LENDPG_1" ABSReportCode="" Title="Lender Portal Collateral Screen Basic" Description="CS Basic Report" Price="0">
<account AccountNumber="6551198" Address="000 Main St" City="Spokane" State="WA" ZipCode="99201" />
<contact FirstName="Person" LastName="Ordering" Email="person#domain.com" Phone="000-000-0000" />
<outputtypecoll>
<outputtype Type="XML" FileName="" />
</outputtypecoll>
<featurecoll>
<feature Name="CSRDISTANCE" Value="false" />
<feature Name="CSRDBSTATUS" Value="false" />
<feature Name="CSRELEVATION" Value="false" />
<feature Name="FINDTP" Value="TRUE" />
<feature Name="DETAILS" Value="TRUE" />
</featurecoll>
<targetpropertycoll>
<targetproperty SiteIndex="0" PropertyGUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ExternalPropertyGUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" MonitoringGUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" PortfolioGUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" OrderGUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" PropertyName="My Property" Address="1 Wherever Ave" City="Sometown" State="CA" ZipCode="99999" Latitude="30.111111" Longitude="-110.88888">
<georeferenced Address="My Property" City="Sometown" State="CA" ZipCode="99999" Latitude="30.111111" Longitude="-110.88888" Fips="" County="" PostalCity="" />
<searchdistancecoll SetID="0000" SetName="LendPort Collateral" MaxDistance="5280" />
<edrdatacoll>
<edrdata Name="REPORTCOST" Value="0.00" />
<edrdata Name="BORROWER" Value="" />
<edrdata Name="LOANTYPE" Value="Other" />
<edrdata Name="LOANNUMBER" Value="" />
<edrdata Name="PROPERTYTYPE" Value="" />
<edrdata Name="DESTHOST" Value="www.xxxxxxxxxxx.com" />
</edrdatacoll>
</targetproperty>
</targetpropertycoll>
</report>
</reportrequest>
This certainly has a root element.
What can be causing this seemingly bogus exception?
Try adding this as the first line of the file
<?xml version="1.0" encoding="UTF-8"?>
EDIT:
Change this
Dim xmlDoc As New XmlDocument()
xmlDoc.Load(xmlPath)
to this
Dim xmlDoc As New XmlDocument()
Try
xmlDoc.Load(xmlPath)
Catch ex As Exception
Dim xe As XElement
xe = XElement.Load(xmlPath)
Stop
End Try
Related
I am working on a web application. the Web.config file is set to NeverOverwrite (=yes) in its initial installation. Now i need to add DBproviderfactories like below. Can i add this entire block using XmlFile in a patch.msp? I do not want to write a custom action. All I need is to add this block in the web.config. Any suggestion here is appreciated.
<system.data>
<DbProviderFactories>
<!-- Remove in case this is already defined in machine.config -->
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="Oracle Data Provider for .NET" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
Sample: Maybe try this:
https://github.com/glytzhkof/WiXUpdateXmlFile
Below is the gist of it - please use the sample above for testing. The markup below is just for illustration.
Set the XML file both permanent and never overwrite.
See inline instructions in the sample above for testing.
Check what happens on uninstall - this markup will remove the entries it added.
<!-- Set app.config permanent and never overwrite to yes -->
<Component Feature="ProductFeature" NeverOverwrite="yes" Permanent="yes">
<File Source="app.config" />
</Component>
<!-- The XML update -->
<!-- Use a NEW GUID here, do not go live with this one -->
<Component Id="XmlFileUpdate" Guid="{00000000-0000-0000-0000-7405EED51B57}" Feature='ProductFeature'>
<!--Create New Element-->
<util:XmlFile Id='XmlSettings1' File='[INSTALLFOLDER]app.config' Action='createElement' Name='MyConfig' ElementPath='//configuration' Sequence='1' />
<!--Set New Value-->
<util:XmlFile Id='XmlSettings2' File='[INSTALLFOLDER]app.config' Action='setValue' Name='newVersion' Value='6.6.8' ElementPath='//configuration/MyConfig' Sequence='2' />
<!--Set New Value-->
<util:XmlFile Id='XmlSettings3' File='[INSTALLFOLDER]app.config' Action='setValue' Name='Server' Value='Pusevov' ElementPath='//configuration/MyConfig' Sequence='3' />
<!--Update Existing Value, Existing Element-->
<util:XmlFile Id='XmlSettings4' File='[INSTALLFOLDER]app.config'
Action='setValue' Name='newVersion' Value='7.7.7' ElementPath='//configuration/ExistingConfig/bindingRedirect' Sequence='4' />
<CreateFolder />
</Component>
</Directory>
</Directory>
Link:
Added new application setting to app.config but MSI won't install it (doesn't overwrite)
I´ve a Windows Service and I want to log some information with NLog. My NLog file looks like:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<time type="AccurateUtc" />
<targets>
<target name="debug-logfile" xsi:type="File" fileName="${specialfolder:folder=ApplicationData}/log/${date:format=yyyy-MM}.log" layout="${longdate} | ${level} | ${message}" />
<target name="trace-logfile" xsi:type="File" fileName="${specialfolder:folder=ApplicationData}/log/trace/${date:format=yyyy-MM-dd}.log" layout="${date:format=yyyy-MM-dd HH\:mm\:ss.fffffff} | ${level} | ${message}" />
<target name="errorfile" xsi:type="File" fileName="${specialfolder:folder=ApplicationData}/log/Error.log" layout="${longdate} | ${level} | ${message}" />
<target name="console" xsi:type="Console" layout="${longdate} | ${level} | ${callsite} | ${message}"/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="trace-logfile" />
<logger name="*" minlevel="Debug" writeTo="debug-logfile" />
<logger name="*" minlevel="Error" writeTo="errorfile" />
</rules>
</nlog>
Now the problem is, the %appdata% folder for my service is: C:\Windows\System32\config\systemprofile\AppData\Roaming and NLog can´t write into this folder. May someone tell me how to get access to this folder or change it to default ServiceProfile folder? (C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\ATLED\log\trace)
I think it´s possible to change it when I give the service the local service user but it´s installed with WIX so may the problem be there. Here the WIX code sample:
<Component Id="CMP_Service" Feature="Core">
<File Source="$(var.Servie.TargetPath)" KeyPath="yes"/>
<ServiceInstall Id="ServiceInstallELS"
Name="Service"
Description="..."
Start="auto"
Account="[SERVICEACCOUNT]"
ErrorControl="normal"
Type="ownProcess"
Vital="no" />
<ServiceControl Id="ServiceControllELS"
Name="Service"
Start="install"
Stop="both"
Remove="uninstall"
Wait="no" />
</Component>
EDIT
With installutil.exe the service writes it´s logs into: C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\ATLED\log\trace
I am new to NLog. But i faced similar issues when i used Log4Net with windows service . I was setting "appdata" path manually from the code. There must be a way in NLog also to set this path manually from code.
However when windows service runs as you mentioned it will take "appdata" path as the one you have mentioned.
To overcome this, i have used WMI windows API's. Please refer the below example.
Idea here is to get the UserName from WMI API's and construct the path manually .
private string GetWindowsUserAccountName()
{
string userName = string.Empty;
ManagementScope ms = new ManagementScope("\\\\.\\root\\cimv2");
ObjectQuery query = new ObjectQuery("select * from win32_computersystem");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(ms, query);
foreach (ManagementBaseObject mo in searcher?.Get())
{
userName = mo["username"]?.ToString();
}
userName = userName?.Substring(userName.IndexOf(#"\",StringComparison.InvariantCulture) + 1);
FCLogger.Logger.LogDebug("[ReturnWindowsUserAccountName]UserName Fetched:" + userName);
return userName;
}
You can construct path by your own , because only the UserName is unknown field here .
var userName = GetWindowsUserAccountName();
var appDataPath = Path.Combine(LoggerConstants.C, LoggerConstants.USERS, userName, LoggerConstants.APP_DATA, LoggerConstants.ROAMING);
//Ex: "C:\\Users\\" + userName from WMI +"\\AppData"+"\\Roaming" ;
We have an (old) build definition is using the UpgradeTemplate.xaml on TFS 2015 (and an underlying TFSBuild.proj which has a heap of custom actions). As such, the task of properly modernising the build is going to take time.
I'd like to hack the UpgradeTemplate to add in C#6/VB14 support without requiring a full re-write of the build definition, in order to keep the devs happy.
I attempted to edit the UpgradeTemplate.xaml to add a ToolPath property on the TfsBuild. However, now that I have done this, I get the following error on nearly all my projects:
ArgumentOutOfRangeException: Index and length must refer to a location within the string. Parameter name: length
On investigation, the lines of code in these projects all look like this:
<MSBuild.ExtensionPack.VisualStudio.TfsVersion TaskAction="GetVersion"
BuildName="$(BuildDefinition)" TfsBuildNumber="$(BuildNumber)"
VersionFormat="DateTime" DateFormat="MMdd" Major="$(MajorVersion)"
Minor="$(MinorVersion)">
The values of these variables as set printed out by Message tasks on the vbproj:
BuildDefinition: MyBuild-Testing
BuildNumber: 57902
MajorVersion: 43
MinorVersion: 2
The Build server has version 3.5.10 on the MSBuild ExtensionPack installed.
How do I resolve this issue? I'm testing this with a new build definition to allow devs to continue working while I get this set up, so I don't want to replace the ExtensionPack with the latest release (if possible) if it is likely to break the existing build.
Upgrade Template
<Activity mc:Ignorable="sad" x:Class="TfsBuild.Process" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mtbc="clr-namespace:Microsoft.TeamFoundation.Build.Client;assembly=Microsoft.TeamFoundation.Build.Client" xmlns:mtbw="clr-namespace:Microsoft.TeamFoundation.Build.Workflow;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtbwa="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtbwt="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Tracking;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:sad="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sad1="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:this="clr-namespace:TfsBuild;" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Members>
<x:Property Name="ConfigurationFolderPath" Type="InArgument(x:String)" />
<x:Property Name="AgentSettings" Type="InArgument(mtbwa:AgentSettings)" />
<x:Property Name="MSBuildArguments" Type="InArgument(x:String)" />
<x:Property Name="MSBuildPlatform" Type="InArgument(mtbwa:ToolPlatform)" />
<x:Property Name="DoNotDownloadBuildType" Type="InArgument(x:Boolean)" />
<x:Property Name="LogFilePerProject" Type="InArgument(x:Boolean)" />
<x:Property Name="SourcesSubdirectory" Type="InArgument(x:String)" />
<x:Property Name="BinariesSubdirectory" Type="InArgument(x:String)" />
<x:Property Name="TestResultsSubdirectory" Type="InArgument(x:String)" />
<x:Property Name="RecursionType" Type="InArgument(mtvc:RecursionType)" />
<x:Property Name="Verbosity" Type="InArgument(mtbw:BuildVerbosity)" />
<x:Property Name="Metadata" Type="mtbw:ProcessParameterMetadataCollection" />
<x:Property Name="SupportedReasons" Type="mtbc:BuildReason" />
</x:Members>
<this:Process.ConfigurationFolderPath>
<InArgument x:TypeArguments="x:String" />
</this:Process.ConfigurationFolderPath>
<this:Process.AgentSettings>[New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly }]</this:Process.AgentSettings>
<this:Process.MSBuildArguments>
<InArgument x:TypeArguments="x:String" />
</this:Process.MSBuildArguments>
<this:Process.MSBuildPlatform>[Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto]</this:Process.MSBuildPlatform>
<this:Process.DoNotDownloadBuildType>[False]</this:Process.DoNotDownloadBuildType>
<this:Process.LogFilePerProject>[False]</this:Process.LogFilePerProject>
<this:Process.SourcesSubdirectory>
<InArgument x:TypeArguments="x:String" />
</this:Process.SourcesSubdirectory>
<this:Process.BinariesSubdirectory>
<InArgument x:TypeArguments="x:String" />
</this:Process.BinariesSubdirectory>
<this:Process.TestResultsSubdirectory>
<InArgument x:TypeArguments="x:String" />
</this:Process.TestResultsSubdirectory>
<this:Process.RecursionType>[Microsoft.TeamFoundation.VersionControl.Client.RecursionType.OneLevel]</this:Process.RecursionType>
<this:Process.Verbosity>[Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]</this:Process.Verbosity>
<this:Process.Metadata>
<mtbw:ProcessParameterMetadataCollection />
</this:Process.Metadata>
<this:Process.SupportedReasons>All</this:Process.SupportedReasons>
<mva:VisualBasic.Settings>Assembly references and imported namespaces serialized as XML namespaces</mva:VisualBasic.Settings>
<Sequence mtbwt:BuildTrackingParticipant.Importance="None">
<Sequence.Variables>
<Variable x:TypeArguments="mtbc:IBuildDetail" Name="BuildDetail" />
</Sequence.Variables>
<mtbwa:GetBuildDetail DisplayName="Get the Build" Result="[BuildDetail]" />
<mtbwa:InvokeForReason DisplayName="Update Build Number for Triggered Builds" Reason="Triggered">
<mtbwa:UpdateBuildNumber BuildNumberFormat="["$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)"]" DisplayName="Update Build Number" />
</mtbwa:InvokeForReason>
<mtbwa:AgentScope DisplayName="Run On Agent" MaxExecutionTime="[AgentSettings.MaxExecutionTime]" MaxWaitTime="[AgentSettings.MaxWaitTime]" ReservationSpec="[AgentSettings.GetAgentReservationSpec()]">
<mtbwa:AgentScope.Variables>
<Variable x:TypeArguments="x:String" Name="buildDirectory" />
</mtbwa:AgentScope.Variables>
<mtbwa:GetBuildDirectory DisplayName="Get the Build Directory" Result="[buildDirectory]" />
<If Condition="[Not String.IsNullOrEmpty(ConfigurationFolderPath)]" DisplayName="If Not String.IsNullOrEmpty(ConfigurationFolderPath)">
<If.Then>
<mtbwa:TfsBuild BinariesSubdirectory="[BinariesSubdirectory]" BuildDirectory="[buildDirectory]" CommandLineArguments="[MSBuildArguments]" ConfigurationFolderPath="[ConfigurationFolderPath]" DisplayName="Run TfsBuild for Configuration Folder" DoNotDownloadBuildType="[DoNotDownloadBuildType]" LogFilePerProject="[LogFilePerProject]" RecursionType="[RecursionType]" SourcesSubdirectory="[SourcesSubdirectory]" TestResultsSubdirectory="[TestResultsSubdirectory]" ToolPath="C:\Program Files (x86)\MSBuild\12.0\Bin\" ToolPlatform="[MSBuildPlatform]" Verbosity="[Verbosity]" />
</If.Then>
</If>
<If Condition="[BuildDetail.CompilationStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Unknown]" DisplayName="If CompilationStatus = Unknown">
<If.Then>
<mtbwa:SetBuildProperties CompilationStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Succeeded]" DisplayName="Set CompilationStatus to Succeeded" PropertiesToSet="CompilationStatus" />
</If.Then>
</If>
<If Condition="[BuildDetail.TestStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Unknown]" DisplayName="If TestStatus = Unknown">
<If.Then>
<mtbwa:SetBuildProperties DisplayName="Set TestStatus to Succeeded" PropertiesToSet="TestStatus" TestStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Succeeded]" />
</If.Then>
</If>
</mtbwa:AgentScope>
<mtbwa:InvokeForReason Reason="CheckInShelveset">
<mtbwa:CheckInGatedChanges DisplayName="Check In Gated Changes" />
</mtbwa:InvokeForReason>
</Sequence>
</Activity>
In Particular, I added ToolPath="C:\Program Files (x86)\MSBuild\12.0\Bin\" to line 58.
TFSBuild.proj
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\SDC\Microsoft.Sdc.Common.tasks" />
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks"/>
<ProjectExtensions>
<!-- Team Foundation Build Version - DO NOT CHANGE -->
<ProjectFileVersion>2</ProjectFileVersion>
</ProjectExtensions>
<PropertyGroup>
<RunCodeAnalysis>Never</RunCodeAnalysis>
<UpdateAssociatedWorkItems>false</UpdateAssociatedWorkItems>
<AdditionalVCOverrides></AdditionalVCOverrides>
<CustomPropertiesForClean></CustomPropertiesForClean>
<CustomPropertiesForBuild></CustomPropertiesForBuild>
<SkipGetChangesetsAndUpdateWorkItems>False</SkipGetChangesetsAndUpdateWorkItems>
<SkipWorkItemCreation>true</SkipWorkItemCreation>
<BuildConfigurationsInParallel>true</BuildConfigurationsInParallel>
<SkipDropBuild>false</SkipDropBuild>
</PropertyGroup>
<ItemGroup>
<SolutionToBuild Include="$(BuildProjectFolderPath)/SolutionsToBuild/Common.sln">
<Targets></Targets>
<Properties></Properties>
</SolutionToBuild>
</ItemGroup>
<ItemGroup>
<ConfigurationToBuild Include="Release|Any CPU">
<FlavorToBuild>Release</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
</ItemGroup>
<PropertyGroup>
<SkipClean>false</SkipClean>
<SkipInitializeWorkspace>true</SkipInitializeWorkspace>
<ForceGet>true</ForceGet>
<IncrementalBuild>false</IncrementalBuild>
</PropertyGroup>
</Project>
Update
I think it might be something to do with running a private build (Latest + Shelveset). When I run a normal build, the BuildNumber variable is MyBuild-Testing_20170328.1. This appears to be working fine.
This issue is due to a difference between Private and Public builds. With Public Builds, the build is immediately numbered as BuildName_DateFormat.BuildNumber. Private builds however, are just numeric (e.g. 57902 above).
The Code in the extension does the following:
string buildstring = this.TfsBuildNumber.Replace(string.Concat(this.BuildName, "_"),
string.Empty);
char[] chrArray = new char[] { '.' };
string[] buildParts = buildstring.Split(chrArray, StringSplitOptions.RemoveEmptyEntries);
DateTime t = new DateTime(Convert.ToInt32(buildParts[0].Substring(0, 4),
CultureInfo.CurrentCulture),
Convert.ToInt32(buildParts[0].Substring(4, 2),
CultureInfo.CurrentCulture),
Convert.ToInt32(buildParts[0].Substring(6, 2),
CultureInfo.InvariantCulture));
Are you can see, its substringing on the build name, assuming it's been stripped down to the date component (20170328). Private builds aren't this long, and so fail.
This build works fine when running as a public build - basically it means that private builds on this definition are not available until an upgrade takes place.
I am working on a sample file in Xliff 1.2 but confused with annotation.As I didnot find anywhere whether it supports custom annotation or not?
Can anyone refer links for sample xliff1.2 file with annotations(if it supports any kind of annotations)
Thanks
you can read more about this in the following link:
http://docs.oasis-open.org/xliff/v1.2/cs02/xliff-core.html#note
This is an example:
<xliff version="1.2">
<file original="Graphic Example.psd"
source-language="en-US" target-language="ja-JP"
tool="Rainbow" datatype="photoshop">
<header>
<skl>
<external-file uid="3BB236513BB24732" href="Graphic Example.psd.skl"/>
</skl>
<phase-group>
<phase phase-name="extract" process-name="extraction"
tool="Rainbow" date="20010926T152258Z"
company-name="NeverLand Inc." job-id="123"
contact-name="Peter Pan" contact-email="ppan#example.com">
<note>Make sure to use the glossary I sent you yesterday.
Thanks.</note>
</phase>
</phase-group>
</header>
<body>
<trans-unit id="1" maxbytes="14">
<source xml:lang="en-US">Quetzal</source>
<target xml:lang="ja-JP">Quetzal</target>
</trans-unit>
<trans-unit id="3" maxbytes="114">
<source xml:lang="en-US">An application to manipulate and
process XLIFF documents</source>
<target xml:lang="ja-JP">XLIFF 文書を編集、または処理
するアプリケーションです。</target>
</trans-unit>
<trans-unit id="4" maxbytes="36">
<source xml:lang="en-US">XLIFF Data Manager</source>
<target xml:lang="ja-JP">XLIFF データ・マネージャ</target>
</trans-unit>
</body>
</file>
</xliff>
There is the build rule (below) which was used to compile x64 assembly with Visual Studio 2005. It works well but the issue is appearing on Windows8 machine. And compiler fires the next error:
1>Assembling x64...
1>Project : error PRJ0003 : Error spawning 'cmd.exe'.
while 32bin assembly builds successfully. Any ideas how to fix it?
The rule is located in "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\VCProjectDefaults" directory and ml64.exe in "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\amd64" and "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\x86_amd64".
< ?xml version="1.0" encoding="utf-8"?>
< VisualStudioToolFile
Name="Microsoft Macro Assembler x64"
Version="8.00">
<Properties>
<BooleanProperty
Name="NoLogo"
DisplayName="Suppress Startup Banner"
Description="Suppress the display of the startup banner and information messages. (/nologo)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/nologo"
DefaultValue="true"
/>
<BooleanProperty
Name="TinyMemoryModelSupport"
DisplayName="Tiny Memory Model Support"
PropertyPageName="Advanced"
Description="Enables tiny-memory-model support. Note that this is not equivalent to the .MODEL TINY directive. (/AT)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/AT"
/>
<StringProperty
Name="ObjectFileName"
DisplayName="Object File Name"
PropertyPageName="Object File"
Description="Specifies the name of the output object file. (/Fo:[file])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Fo"[value]""
DefaultValue="$(IntDir)\$(InputName).obj"
/>
<EnumProperty
Name="PreserveIdentifierCase"
DisplayName="Preserve Identifier Case"
Description="Specifies preservation of case of user identifiers. (/Cp, /Cu, /Cx)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
DefaultValue="0"
<Values>
<EnumValue
Value="0"
DisplayName="Default"
/>
<EnumValue
Value="1"
Switch="/Cp"
DisplayName="Preserves Identifier Case (/Cp)"
/>
<EnumValue
Value="2"
Switch="/Cu"
DisplayName="Maps all identifiers to upper case. (/Cu)"
/>
<EnumValue
Value="3"
Switch="/Cx"
DisplayName="Preserves case in public and extern symbols. (/Cx)"
/>
</Values>
</EnumProperty>
<StringProperty
Name="PreprocessorDefinitions"
DisplayName="Preprocessor Definitions"
Description="Defines a text macro with the given name. (/D[symbol])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/D"[value]""
Delimited="true"
Inheritable="true"
/>
<BooleanProperty
Name="GeneratePreprocessedSourceListing"
DisplayName="Generate Preprocessed Source Listing"
PropertyPageName="Listing File"
Description="Generates a preprocessed source listing to the Output Window. (/EP)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/EP"
/>
<StringProperty
Name="AssembledCodeListingFile"
DisplayName="Assembled Code Listing File"
PropertyPageName="Listing File"
Description="Generates an assembled code listing file. (/Fl[file])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Fl"[value]""
/>
<StringProperty
Name="SourceListingLineWidth"
DisplayName="Source Listing Line Width"
PropertyPageName="Listing File"
Description="Sets the line width of source listing in characters per line. Range is 60 to 255. Same as PAGE width. (/Sl [width])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sl [value]"
/>
<StringProperty
Name="SourceListingPageLength"
DisplayName="Source Listing Page Length"
PropertyPageName="Listing File"
Description="Sets the page length of source listing in lines per page. Range is 10 to 255. Same as PAGE length. (/Sp [length])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sp [value]"
/>
<StringProperty
Name="IncludePaths"
DisplayName="Include Paths"
Description="Sets path for include file. A maximum of 10 /I options is allowed. (/I [path])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/I "[value]""
Delimited="true"
Inheritable="true"
/>
<BooleanProperty
Name="ListAllAvailableInformation"
DisplayName="List All Available Information"
PropertyPageName="Listing File"
Description="Turns on listing of all available information. (/Sa)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sa"
/>
<BooleanProperty
Name="UseSafeExceptionHandlers"
DisplayName="Use Safe Exception Handlers"
PropertyPageName="Advanced"
Description="Marks the object as either containing no exception handlers or containing exception handlers that are all declared with .SAFESEH. (/safeseh)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/safeseh"
/>
<BooleanProperty
Name="AddFirstPassListing"
DisplayName="Add First Pass Listing"
PropertyPageName="Listing File"
Description="Adds first-pass listing to listing file. (/Sf)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sf"
/>
<BooleanProperty
Name="EnableAssemblyGeneratedCodeListing"
DisplayName="Enable Assembly Generated Code Listing"
PropertyPageName="Listing File"
Description="Turns on listing of assembly-generated code. (/Sg)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sg"
/>
<BooleanProperty
Name="DisableSymbolTable"
DisplayName="Disable Symbol Table"
PropertyPageName="Listing File"
Description="Turns off symbol table when producing a listing. (/Sn)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sn"
/>
<StringProperty
Name="SourceListingSubTitle"
DisplayName="Source Listing Subtitle"
PropertyPageName="Listing File"
Description="Specifies subtitle text for source listing. Same as SUBTITLE text. (/Ss [subtitle])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Ss [value]"
/>
<StringProperty
Name="SourceListingTitle"
DisplayName="Source Listing Title"
PropertyPageName="Listing File"
Description="Specifies title for source listing. Same as TITLE text. (/St [title])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/St [value]"
/>
<BooleanProperty
Name="EnableFalseConditionalsInListing"
DisplayName="Enable False Conditionals In Listing"
PropertyPageName="Listing File"
Description="Turns on false conditionals in listing. (/Sx)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Sx"
/>
<EnumProperty
Name="WarningLevel"
DisplayName="Warning Level"
Description="Sets the warning level, where level = 0, 1, 2, or 3. (/W0, /W1, /W2, /W3)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
DefaultValue="3"
<Values>
<EnumValue
Value="0"
Switch="/W0"
DisplayName="Warning Level 0 (/W0)"
/>
<EnumValue
Value="1"
Switch="/W1"
DisplayName="Warning Level 1 (/W1)"
/>
<EnumValue
Value="2"
Switch="/W2"
DisplayName="Warning Level 2 (/W2)"
/>
<EnumValue
Value="3"
Switch="/W3"
DisplayName="Warning Level 3 (/W3)"
/>
</Values>
</EnumProperty>
<BooleanProperty
Name="TreatWarningsAsErrors"
DisplayName="Treat Warnings As Errors"
Description="Returns an error code if warnings are generated. (/WX)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/WX"
/>
<BooleanProperty
Name="MakeAllSymbolsPublic"
DisplayName="Make All Symbols Public"
PropertyPageName="Object File"
Description="Makes all symbols public. (/Zf)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Zf"
/>
<BooleanProperty
Name="GenerateDebugInformation"
DisplayName="Generate Debug Information"
Description="Generates Debug Information. (/Zi)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Zi"
DefaultValue="true"
/>
<BooleanProperty
Name="EnableMASM51Compatibility"
DisplayName="Enable MASM 5.1 Compatibility"
Description="Enables M510 option for maximum compatibility with MASM 5.1. (/Zm)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Zm"
/>
<EnumProperty
Name="PackAlignmentBoundary"
DisplayName="Pack Alignment Boundary"
PropertyPageName="Advanced"
Description="Packs structures on the specified byte boundary. The alignment can be 1, 2, 4, 8 or 16. (/Zp1, /Zp2, /Zp4, /Zp8, /Zp16)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
<Values>
<EnumValue
Value="0"
DisplayName="Default"
/>
<EnumValue
Value="1"
Switch="/Zp1"
DisplayName="One Byte Boundary (/Zp1)"
/>
<EnumValue
Value="2"
Switch="/Zp2"
DisplayName="Two Byte Boundary (/Zp2)"
/>
<EnumValue
Value="3"
Switch="/Zp4"
DisplayName="Four Byte Boundary (/Zp4)"
/>
<EnumValue
Value="4"
Switch="/Zp8"
DisplayName="Eight Byte Boundary (/Zp8)"
/>
<EnumValue
Value="5"
Switch="/Zp16"
DisplayName="Sixteen Byte Boundary (/Zp16)"
/>
</Values>
</EnumProperty>
<BooleanProperty
Name="PerformSyntaxCheckOnly"
DisplayName="Perform Syntax Check Only"
Description="Performs a syntax check only. (/Zs)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/Zs"
/>
<EnumProperty
Name="CallingConvention"
DisplayName="Calling Convention"
PropertyPageName="Advanced"
Description="Selects calling convention for your application. (/Gc, /Gd. /Gz)"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
<Values>
<EnumValue
Value="0"
DisplayName="Default"
/>
<EnumValue
Value="1"
Switch="/Gd"
DisplayName="Use C-style Calling Convention (/Gd)"
/>
<EnumValue
Value="2"
Switch="/Gz"
DisplayName="Use stdcall Calling Convention (/Gz)"
/>
<EnumValue
Value="3"
Switch="/Gc"
DisplayName="Use Pascal Calling Convention (/Gc)"
/>
</Values>
</EnumProperty>
<EnumProperty
Name="ErrorReporting"
DisplayName="Error Reporting"
PropertyPageName="Advanced"
Description="Reports internal assembler errors to Microsoft. (/errorReport:[method])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
<Values>
<EnumValue
Value="0"
Switch="/errorReport:prompt"
DisplayName="Prompt to send report immediately (/errorReport:prompt)"
/>
<EnumValue
Value="1"
Switch="/errorReport:queue"
DisplayName="Prompt to send report at the next logon (/errorReport:queue)"
/>
<EnumValue
Value="2"
Switch="/errorReport:send"
DisplayName="Automatically send report (/errorReport:send)"
/>
<EnumValue
Value="3"
Switch="/errorReport:none"
DisplayName="Do not send report (/errorReport:none)"
/>
</Values>
</EnumProperty>
<StringProperty
Name="BrowseFile"
DisplayName="Generate Browse Information File"
PropertyPageName="Advanced"
Description="Specifies whether to generate browse information file and its optional name or location of the browse information file. (/FR[name])"
HelpURL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrfml.asp"
Switch="/FR"[value]""
Delimited="true"
Inheritable="true"
/>
</Properties>
</CustomBuildRule>
</Rules>
Error spawning 'cmd.exe'.
Your machine is pretty messed up, Visual Studio cannot start the command processor. First you need to check if cmd.exe is still located in the c:\windows\system32 directory. Next you need to check if your environment variables are still correct. Which is the more typical mishap, uninstallers tend to screw this up.
Start + Control Panel, System, Advanced, Environment Variables button. Look at the System variables displayed there. The ComSpec variable needs to point to c:\windows\system32\cmd.exe. The Path environment variable needs to start with c:\windows\system32;c:\windows. I'm using the default names for these directories, small chance that they are different on your machine. Log out and log back in to make changes effective.