In Visual Studio 2012, I would like to be able to hit a button or keystroke that switches to a particular solution configuration (say, Release) and then builds in that configuration. I have been unable to find a way to do so. Does something like this exist?
This sounds like it should be fairly easy to do as a Visual Studio Add-In. Add-ins are one of the lighter-weight ways to extend Visual Studio. You'll probably want to look into:
How to create an add in
How to add your add-in to a toolbar. You could also create your own dedicated toolbar if you wish.
When your command gets called, you probably need to set the ConfigurationManager.ActiveConfiguration property to your desired configuration or the SolutionBuild.ActiveConfiguration property (you'll have to play around to see which one does what you want). Note that this does change the state of VS, so it may fire some other events in the IDE that happen when the build configuration changes.
Then, just invoke the build as a named command (e.g. DTE.ExecuteCommand("Build.BuildSolution")). IIRC, invoking this way is synchronous, so when control returns to your code, the build will be complete.
Set the configuration back to how it was before to clean up after yourself.
Related
I've was excited that they added the instant run feature.
As I mentioned, this feature isn't working as it should.
Sometimes it don't apply changes and it makes hard to debug!
Is something to check/uncheck or change the settings to make it work properly?
Kind Regards.
I have a native Win32 project written in C and wanted to visualize my project's dependencies from external DLLs. Visual Studio 2012 and 2013 let me generate a code map which would not only show all my functions and their dependencies from each other using arrows, but also all external libraries I used, which functions I used from those and which of my functions called which external functions etc..
Now, in Visual Studio 2015, this latter part seems to be missing. I can not get Visual Studio to show my project's external dependencies. I only see the internal ones. So here's my questions: Am I missing something? Do I have to activate a specific option in my project settings? Or are those external dependencies just not working in Visual Studio 2015 right now?
Steps to reproduce: Create a new non-empty Win32-project. In the Architecture menu, select Generate code map for solution. You will only see Win32Project1.exe in the middle of the screen. Meanwhile, Visual C# seems to be fine, showing the external dependencies. Create any C#-project for comparison.
Thank you for taking the time to post this! This looks like a regression, as in Visual Studio 2013 an Externals group with external dependencies is shown for C++.
I've logged a bug on Microsoft Connect so that you're able to track this externally:
https://connect.microsoft.com/VisualStudio/feedback/details/1694695
I have posted this workaround on the link that Bogdan Gavril listed and hope it helps someone. Unfortunately, it requires that you enable "CLR" support for your project. Basically, it appears that the VC++ linker and librarian is looking for a flag that indicates some type of managed code. At the very least, the code map is dependent on the mscorlib.dll reference injection. To make the CLR issue (which adds a lot of unnecessary bulk for native code) less a problem, simply create a new build configuration for use only when you need code maps with external dependencies. Make sure you've selected "CLR Support" on the general options of the project properties configuration page. Then, clean (probably not necessary) your solution and generate a code map. You will find the external dependencies as expected!
Zac
I've been using CMAKE recently on Linux and Windows and I really like it. Its a great way of spinning up a project and organizing your builds. There are just a few things that are bugging me and I'm hoping to get help here.
Visual Studio Settings
Everytime CMAKE generates a project it will be a fresh solution and will not maintain any of the settings you applied to the Visual Studio project. I know that many things such as CMAKE_CXX_FLAGS, etc can change the properties. But what if I want to change settings such as "Suppress Startup Banner", "Environment", Enabling Microsoft Symbol Server, Enabling Native Code Debugging. How do I force CMAKE to set the options I want for fields like these?
Combining Debug/Release/Etc into one solution
It seems that with CMAKE you have to do separate generations for Debug/Release/etc. But in typical manually created Visual Studio projects you can combine the profiles and just change a project setting to get your new settings. Is it possible to generate a single solution file from CMAKE?
Okay so I scoured the CMAKE boards as well. Here are the answers I found.
Visual Studio Settings
For this one CMAKE can't modify the *.user files at all. However what was proposed was to make a user file template and then use CMAKE to supply all the paths and such that you are concerned with. This worked very well for me.
Combining Debug/Release/Etc into one solution
To change various settings on a per configuration basis. It seems like it is best to use fields like CMAKE_CXX_FLAGS_ and most importantly generator expressions. Generator expressions allow you to test for the build type and then generate whatever include, libraries, etc that you need.
Take a look at "Generator Expressions" here
I am developing an InstallShield InstallScript project (not MSI) and currently working on the "updatemode" behaviour of the setup.exe program.
I would like to know if it is possible to ignore the update of one specific feature and still update the other ones.
The problem is that the program needs to determine whether the feature should be updated during the execution, which means the feature has to be embedded in the update program.
I've already tried to use the InstallScript function FeatureSetItem, but when I set my feature to false, the feature is not ignored, but uninstalled by my update program.
Any idea would be helpful.
Not sure what it is that you don't want to be updated or why, but if it's just files then set the components for the feature to "overwrite by date" or "overwrite by version".
In InstallShield, go to "Releases". Create a new "Release" and then go through the Release Wizard.
One of the windows in the release wizard allows you to check/uncheck the features for that release. Simply uncheck the features that you do not want to update. This way, those features will not be included when you build that particular release configuration. They will still be included if you build using the original release configuration.
Can you please advice how I can speed up a compiling, loading big solution (~50 projects).
I mean only VS 2012 studio or Windows settings, not hardware changes.
Thanks
Consider your need for 50 projects in one solution - having many projects that are referenced by each other is one of the main reasons for slowdowns.
One of the few valid reasons to have separate projects is because you need to deploy the generated assemblies separately. If this is not the case, consider combining projects - use folders for the logical separation.
The lower the number of projects, the faster your build will become.
In addition, if you change the builds to output to a specific shared directory and reference the DLLs instead of the projects, the number of unneeded re-compilations should go down drastically, though you will have to manage the build order yourself.
I use 100+ projects in a solution with Visual Studio 2012 Update 3, and it builds fast.
I agree with shared output directory comment by Oded, but I'd like to mention that project references work OK too.
Make sure that your \Users\\AppData\Local\Microsoft\WebsiteCache folder is empty. Somehow, this is a problem even with desktop-only solutions.
I have disabled Productivity Power Tools 2012, since they compile code in the background, a bit too much for my liking. Disable all plug-ins and extensions and see if it makes any difference.
Suppress excessive output messages to disk and to screen by reducing output verbosity
Use multicore with MSBuild.
As you code, try to limit dependencies between projects by using interfaces and abstract classes (C#).
Try fresh *.suo and fresh *.sdf files. (Make a backup of the user settings and DB, then remove them and try building again)
When all else fails, use ProcessMonitor or attach with another instance of Visual Studio to profile your Visual Studio while it's building.
Try excluding file system filters, such as antivirus, from your build. For example, some antiviruses have a way of skipping scanning in certain directories or by file names.