I wrote a small tool which sits in my solution (as a project), which runs in the background and helps me debug my main project.
I'd like to run the tool with a macro but I haven't found how to get the build path and execute it in the background.
Any VB macro experts ?
To answer your question partly, apparently you can get the solution path from within a macro like this:
System.IO.Path.GetDirectoryName(DTE.Solution.FullName)
I found this in some of the macros listed here. Since you say you've got a project within that solution, you could try DTE.Solution.FindProjectItem and progress from there. It's difficult to give more information without knowing more details about your exact scenario.
Related
Is there any reference or tutorial for this? And if it's possible, have the javascript file being built only if the file is modified.
You might be able to try this:
http://closurecompiler.codeplex.com/documentation,
But I couldn't get it to work and ended up writing a batch file and hooked it up as a post-build process in the project properties. I've been pretty happy with that solution as it allows me to easily (and in a more standardized fashion) tweak the closure parameters. And any errors from it get reported to you whenever you build.
I know I will miss so much of Visual Studio but I am getting really sick of it crashing all the time and being slow, PLUS it is always changing things in my repository that I don't want to change, so I want to just edit with Notepad++. However, now I will have to load up VS just to build things. Is there a way I can build from command line and make a script for it and what not? Will it show the compile errors?
Please don't try to troubleshoot VS for me, I am just asking what is in the question and the rest was just given for context and so nobody was like 'Y U NO RIKE VIZAL STUDIA?'.
build: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe "PATH TO YOUR SOLUTION FILE"
help: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /help
What you need is directly calling csc.exe, the C# compiler (which is called by the build system of Visual Studio, anyways). If you ever worked with GCC, it is quite similar except that options are passed Windows-style with / signs instead of -- and there are no object files or additional linking. The MSDN library has documentation: http://msdn.microsoft.com/en-us/library/78f4aasd.aspx.
Generally, you'd need something like:
csc /target:exe /out:Something.exe *.cs
plus any /reference's you would add in Visual Studio.
If your project is large, it may be uncomfortable to maintain a .bat file to do the compilation, so a build tool like NAnt may be needed, which is quite similar to the Ant used for Java.
This is of course if you want to eliminate Visual Studio entirely. Otherwise, Snowbear's solution of invoking MSBuild.exe will be just as fine.
I'm working with SCAR, A pascal IDE that is used to make macros for runescape. In my program I need to execute an external .py I made. I've searched everywhere and cannot find a working solution.
Are there are functions that will do what I'm asking?
Edit: What I mean is run, just like the program would if you were to double-click on it.
may be this helps you:
http://wiki.lazarus.freepascal.org/Executing_External_Programs
I would like to change the output file name based on certain criteria that I'm checking with #defines. A little background, I'm doing this because I've decided to use VS2010 in one of my projects to regain intellisense. However, this is causing some other problems with Google Test, and the rest of my team is on VS2008. So, I would like to build a GTEST_VS2010.lib if I'm on VS2010, and GTEST.lib otherwise. I was hoping I could trick the compiler with #pragma comment(linker...
but that doesn't seem to be allowed by MS. Thanks for any help.
VS2010 converts project and solution files, doesn't it? Then you don't have a problem since you can't use the project file with VS2008 anyway. Just change the linker's Output File setting.
Otherwise, you probably should just consider adding another configuration to your solution.
I have recently noticed how interesting Visual Studio's macros are. I did not use VB for ages so it took me a while until i finally managed to write a little macro that performs some stuff on the currently open document.
Enthusiastically, I next wanted to use this macro on every source code file (.cs) in the solution without having to manually open all files. Could you give me a quick hint on how to do this?
Check out the DTE object reference. Inside a macro you can reference some really neat global properties, like DTE.Solution, which returns a Solution object that describes the currently open solution (and, not surprisingly, has a Projects property, which is a collection of all Projects in the solution). You should be able to iterate over pretty much anything you want at that point!
Have fun :)