How directly upload arduino generated HEX with avr isp mkii?

I Have Atmega 1284P on a breadboard and can program it with Atmel studio 6 and AVR ISP MKII.
the problem is that i prefer to use arduino libraries, instead of directly working with registers & so on.

  1. can i program & compile it with arduino & then upload generated .HEX file using avr isp mkii & atmel studio?
    i don't need bootloader at all, working with avr isp mkii and atmel studio is easy.
    i read instructions here: http://arduino.cc/en/Hacking/Programmer, and using this method get the error : can not open usb
  2. can i use header files and libraries of arduino right in atmel studio? if yes, how?
    Thanks in advance.

You should be able to program the 1284P directly in the Arduino IDE and use "Upload Using Programmer" to upload sketches via ISP with your AVRISPmkII.

  1. You need to have a 1284P core for the Arduino IDE.
    GitHub - maniacbug/mighty-1284p: Mighty 1284P Platform for Arduino

  2. Depending on which version AVRISPmkII programmer you have, you might be able to use libusb-filter to make it available for use with avrdude and Arduino IDE.(and still work with Atmel Studio Jungo driver)
    http://forum.arduino.cc/index.php?topic=160226.msg1202909#msg1202909