Author Topic: Visual Studios rules for VS2010-2012  (Read 15364 times)

Offline CodeVisio

  • Jr. Member
  • *
  • Posts: 4
Visual Studios rules for VS2010-2012
« on: March 01, 2013, 09:54:24 PM »
Hi,

I found great the nasm's rules about the integration with Visual Studios.
It worked for VS2008.
Is that possible to have rules for VS2010 and VS2012 too?
Can I simply copy the rules files into the VS2010/2012 folders too?

Thanks

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Visual Studios rules for VS2010-2012
« Reply #1 on: March 02, 2013, 08:20:05 PM »
I don't know. What happens if you try it? If it doesn't work, and if you tell us exactly what happens, someone "might" be able to help you (and others) figure out how to make it work. Also see the nearby link from Gunner:

http://www.dreamincode.net/forums/topic/285068-assembler-getting-started/

Since the original authors (Simon Tatham and Julian Hall) moved on to other projects (shortly after 0.98 was released), Nasm has been "user supported". Perhaps you can help! (if you care to)

Best,
Frank


Offline CodeVisio

  • Jr. Member
  • *
  • Posts: 4
Re: Visual Studios rules for VS2010-2012
« Reply #2 on: March 03, 2013, 09:40:42 AM »
Thanks for the answer.

This is the result of my research:
Starting from VS2010 Microsoft changed the rules mechanism. It extended the concept of rules and instead of one file (.rules), now you have three files (.xml, .targets, .props). Also, the default locations for the "rules" is no more VS Installation Dir\VC\VCProjectDefaults but
..MSbuild\Microsoft.Cpp\v4.0\BuildCustomizations\.

How did I proceed:
Is there a way to create these new three files from the old .rules file?
Yes. The only tool available is VS itself. First of all, make a working copy of your project. Second, before removing the nasm.rules file from VCProjectDefaults folder, copy it into your project folder (whatever project you have that uses nasm). Reload your project from VS2008. Right click on the workspace | project |Custom Build Rules...
Uncheck the previous nasm rules option if there is still available. Click on Find Existing button and select the nasm.rules you copied into the project folder and check it. Save all and close VS2008. In this way we have the project .vcproj depending directly from the rules that resides in the project folder. VS2010/2012 conversion utility seems to have problems if the rules resides into VCProjectDefaults folder.
Load the VS2008 project from VS2010 or VS2012. After project conversion, VS should have created three new files, .xml, .targets, .props.
At this point you can leave the three files in your project folder or you can copy them into MSbuild\Microsoft.Cpp\v4.0\BuildCustomizations\ MSbuild folder. In either case you need: right click on the workspace | project |Build Custmizations... menu itemand check the nasm rules option.

Issues:
- In my opinion the conversion utility doesn't work well. In any case I was able to process the file with nasm as I did with VS2008.
Open the .targets file and replace the "%gt;" with ">".
- there is a very little difference in one file (of the three) between VS2010 and VS2012 utilities conversion. You can see it with a diff tool (like WinMerge).
- If you right click on the workspace | project | properties and go to Netwide Macro Assembler | Command Line settings you can see bad characters like mine "nasm.exe -Xvc -o "MyRawImageFile.img" -D -U -l "" -I" instead of "nasm.exe -Xvc  -o "MyRawImageFile.img" -f bin" from VS2008. It's only a presentation problem, since when you go to assemble the file it works well.

My test PC:
-Win7 64 bit
-VS2008 prof
-VS2010 prof
-VS2012 express.

I think with a little work one can fix the issues list above but I'm not an expert of the new Microsoft (.props, .xml, .targets) mechanism and actually I don't have time. Maybe someone else can fix those.

My files:
http://sdrv.ms/XLv6uR
Let me know if you are unable to see and download the files.

EDIT: fixed some English words above.
« Last Edit: March 03, 2013, 11:38:59 AM by CodeVisio »