Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Error creating .exe

Error creating .exe

Scheduled Pinned Locked Moved C#
helpvisual-studiocomdata-structuresdebugging
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sean_mufc
    wrote on last edited by
    #1

    Hello, I am trying to write a simple console app that reads the data contained in specific Excel spreadsheet cells, and use that data to write an .xml file with the XmlTextWriter class. when I go to compile the code, I get an error that says it does not recognise 'using Excel;' and that I may be missing a reference. The thing is I had already added the Excel reference from the Project > Add Reference.. dialog. I run into this error before when writing to an Excel worksheet and after I clicked 'Yes' to continue in the 'Build Errors' dialog, the app ran perfectly, but not this time. I now get an error that says VS cannot start debugging beacuse the debug target \Program.exe is missing. I have never seen this before, can anyone help me? The code below is an extract on my class: class Program { static void Main(string[] args) { //directory of XLS file to be read from string xlsDir = ""; bool xlsError = false; XmlTextWriter writer = new XmlTextWriter("C:\\My Documents\\test1.xml", _UnicodeEncoding); writer.Formatting = Formatting.Indented; int countVPS = 0; //to increment the VPSnodes array string[] VPSnodes = new string[5] { vendorID, vendor, copyright, version, _schemaVersion }; //opens dialog to browse directories and open a file OpenFileDialog openFile = new OpenFileDialog(); openFile.InitialDirectory = "c:\\My Documents"; openFile.Filter = "xls files (*.xls)|*.xls*|xml files (*.xml)*.xml*| _All files (*.*)|*.*"; if (openFile.ShowDialog() == DialogResult.OK) { xlsDir = openFile.FileName; Excel.Workbook wb = this.Application.Workbooks.Open(xlsDir); // activate the active worksheet in the workbook (Microsoft.Office.Interop.Excel._Workbook) _this.Application.Workbooks[1]).Activate(); ((Excel.Worksheet)this.Application.ActiveWorkbook.ActiveSheet); try { if (ExcelObj == null) { Console.WriteLine("\nERROR: EXCEL couldn't be started!"); xlsError = true; } if (xlsError == false) { writer.WriteRaw(""); writer.WriteStartElement("vendorProductSet"); for (int colV = 1; colV <= 5; colV++) { writer.WriteAttributeString(nodes[countVPS], _((Range)ws.Cells[2, col]).Value2); countVPS++;

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups