Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Post build function for Visual Micro in Visual Studio 2015 (Read 6819 times)
Link
Junior Member
**
Offline


Posts: 21
Location: Saint Paul, MN, USA
Joined: Dec 26th, 2015
Post build function for Visual Micro in Visual Studio 2015
Dec 26th, 2015 at 6:42pm
Print Post  
I want to have the output hex file ending up in my code area, not C:\users\...

After turning on verbose, I find the last line of output is:
recipe.hooks.postbuild.0.pattern

Is there a path to leaving the build artifacts in my editing area?

Perhaps there is just an option to set, that I have not found.

Failing that, is there a way I can pipe the hex file location to a post build command file that can do the copy?

I am looking to end up with standard output such as:
"C:\Users\John\AppData\Local\V.Micro\Arduino\Builds\Blink\RFduino/Blink.hex"

To the project folder such as:
C:\Users\John\Documents\Arduino\Blink\bin\Debug\Blink.hex

I use source control by SVN and would like to keep the build artifacts around - by version.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Post build function for Visual Micro in Visual Studio 2015
Reply #1 - Dec 26th, 2015 at 8:47pm
Print Post  
Hi, if you switch on "visual micro/verbose messages" you will see the {variables} that can be used in post build events that you create via an .exe

However that is cumbersome and it's on the list to have an auto copy facility or to allow the build folder to be located in the same way that VS normally works project/release , project/debug etc
  
Back to top
WWW  
IP Logged
 
Link
Junior Member
**
Offline


Posts: 21
Location: Saint Paul, MN, USA
Joined: Dec 26th, 2015
Re: Post build function for Visual Micro in Visual Studio 2015
Reply #2 - Dec 27th, 2015 at 12:36am
Print Post  
Tim,

Thanks for the response,

Tim@Visual Micro wrote on Dec 26th, 2015 at 8:47pm:
see the {variables} that can be used in post build events that you create via an .exe


First on the variables.  I see in the output a phrase such as :
Build folder: file:///C:/Users/John/AppData/Local/V.Micro/Arduino/Builds/Blink/RFduino
Does this mean that "Build folder" is a 'variable'?

Second on .exe:
I wandered around the documentation page and could not find a description of ".exe."  Is there a description of building a .exe and how to reference a 'variable'?

  
Back to top
 
IP Logged
 
Link
Junior Member
**
Offline


Posts: 21
Location: Saint Paul, MN, USA
Joined: Dec 26th, 2015
Re: Post build function for Visual Micro in Visual Studio 2015
Reply #3 - Dec 27th, 2015 at 3:19am
Print Post  
So I find in: 
atform.txt

recipe.hooks.postbuild.0.pattern

can be defined.

?I have tried =echo "Hello, World!" and have only gotten error messages in the output window.  So I know I am editing the correct variable.

Do I need to restart VisualStudio every time I modify platform.txt?

But where can I find all of the definitions of parameters/variables such as:

build.mcu
build.project_name

Is there a variable for the path to the .ino file?

I have searched the web and found scattered references, but I feel I am missing the link to the user manual.
  
Back to top
 
IP Logged
 
Link
Junior Member
**
Offline


Posts: 21
Location: Saint Paul, MN, USA
Joined: Dec 26th, 2015
Re: Post build function for Visual Micro in Visual Studio 2015
Reply #4 - Dec 27th, 2015 at 4:39am
Print Post  
I have made more progress.  I added the line:

recipe.hooks.postbuild.0.pattern=C:\Users\John\Documents\Arduino\PostBuild.bat "{build.path}\{build.project_name}.hex" C:\Users\John\Documents\Arduino\Blink\bin

And the file PostBuild.bat reads simply as:

copy %1 %2

Now if I could only get the second argument to be based on the directory of the .ino, or .vcxproj, I would have what I want.

So please guide me to a description of the build variables.

By naming it PostBuild.bat, I do not have to restart VS2015 unless the arguments change to the .bat file.  Which is more convenient.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Post build function for Visual Micro in Visual Studio 2015
Reply #5 - Dec 27th, 2015 at 4:59pm
Print Post  
Sorry I also meant to say switch on "tools>options>visual micro>compiler>show build properties" which shows the variables before the platform recipes in the output.

The variables are standard arduino build process variables which are documented in their 3rd part build process guide.

If you want to do this you can make your own exe (which would be a new windows console app) or use a .bat but I can't give any support for this because it's all documented on the internet and time consuming.

I can add a setting in a not too distant future release to copy the hex up to the sketch folder. The facility exists it just hasn't been released/tested fully yet.

The visual micro documentation for the "Micro explorer" explains the rescan button will reread any changes you make to the hook or you can click tools>visual micro>reload toolchains. Once you are passing variables to an exe or bat you won't need this option very often.
  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Post build function for Visual Micro in Visual Studio 2015
Reply #6 - Dec 31st, 2015 at 3:57am
Print Post  
In the next release the hex/map etc are copied into the project configuration build location. This normally means project\release or project\debug but you can override in the project properties.
  
Back to top
WWW  
IP Logged
 
Link
Junior Member
**
Offline


Posts: 21
Location: Saint Paul, MN, USA
Joined: Dec 26th, 2015
Re: Post build function for Visual Micro in Visual Studio 2015
Reply #7 - Dec 31st, 2015 at 4:15am
Print Post  
I will be patient for the next release.  Thanks for addressing this issue.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint