Best way to automate editing project file - visual-studio

Actually editing *.cproj files manually, some code in the project template deletes my edits. So i'm forced to edit the file constantly before i build..
What way would you take to automate this:
is it possible to write a vs extension to have a custom tab in project options that reacts to checkboxes modifying project file for me
any other way?..
Thanks

automate editing project file
Something like a button or menu in VS, click it then some content which you used to add manually will be added into .proj file automatically? If I misunderstand, feel free to correct me:)
What way would you take to automate this:
Hard to say, but in short, I think it depends on whether you're experienced in extension development.
Since if you combine the functions into a extension. Every time when you want to add some custom changes to them, all you need to do is just click a button in VS or select a checkbox. It sounds good but the development of extension may take you some time and you may encounter some issues during the development.The journey could be challenging but instersting!
is it possible to write a vs extension to have a custom tab in project
options that reacts to checkboxes modifying project file for me
It's absolutely possible.Just take a look at this extension,it provides a function which edit project in VS.
Not sure the details how your ideal extension is. But I think you may get some help below:
1.Extend menus and commands if you want to start the function by menu command.
Also, you may get some help from this issue which gives the suggestion about how to put function button under Add-node in solution explorer.
2.Assuming you have function code which adds content into a .xxproj file.(This part is about developing, add nodes to xml-based proj file?).Then add that code into a event handle which will be called when clicking the button or menu.(Something like this)
So I think it's possible but may take some time. And it will be the most automatic way but it takes some time to develop. Anyway, hope it helps and good luck with you.

Related

Possible to use or make shortcut to start project without a start page?

Sometimes I want to the project to start with the currently selected page, and other times I want the project to start without opening a page.
I would really like to not have to go into the project properties every time I want to switch... if I have to do that it defeats the purpose and I may as well just always let it open a page even when I don't need it and just close it.
So I would like to leave the setting such that it opens a page when I start debugging, but I wish I had a shortcut that would allow it to start without opening a page (again, without having to go into project properties to change anything).
This doesn't appear to be possible as far as I can tell, but there are some things in Visual Studio I'm less familiar with like the Command Window, or possibly there is a Macro extension or something like that it could be done with. So I thought I'd ask just in case.

Detect file changes outside the Visual Basic 6 IDE?

Background
I am working with VB6 legacy code and I am using an external editor because of the features that it has. Unfortunately, those changes aren't refreshed in the IDE because VB6 doesn't monitor loaded code for changes.
I have done some extensive searching on the subject including looking for alternative editors, a fairly exhaustive internet search including following all of the links on this StackExchange link and haven't found a way to refresh the code window to reflect the external file changes.
My company doesn't have access to the latest edition of Visual Studio and will not be purchasing it anytime in the near future. Until then, there is code to fix.
Question
Aside from restarting the program are there any methods that can be used to refresh the code displayed in the VB6 editing window?
Check out vbAdvance add on. It will prompt you to reload source file in case of external modification.
I think a found one possible solution.
The MZ-Tools set has an function called Reload file from Disk. It also allowed me to create a shortcut for this function through the MZ-Tools options menu, so I assigned it to the shortcut keys of my choosing.
It's a solution, but I'm still looking for anything that might be better.

What's the fastest way to run T4MVC manually in VS 2013?

I'm working on a fairly large project that uses T4MVC. Due to the project size, it takes quite a long time to run my T4MVC template, so using AutoT4MVC is too slow for my scenario.
So every time I change something vital aboutm my action methods, I have to select the T4MVC template, right-click, then click "run custom tool". It's quite tedious and I'm sure there's a better way.
Since AutoT4MVC is not an option, is there any plugin or hack that would allow me to place a button on my IDE that will run the T4MVC template included in my project?
There is a menu item under Build -> Transform all T4 Templates. This will run all the templates in your solution. This command is also available on the Build toolbar, so if you turn that on (View -> Toolbars -> Build) you'll get the button you're looking for.
It should be possible to do basically what AutoT4MVC does, but based on some manual trigger. Or maybe you should suggest on https://github.com/bennor/AutoT4MVC to add a way to turn off automatic mode, and instead rely on a manual action.
I run T4MVC, but AutoT4MVC is a separate project that I'm less familiar with.

Silly Visual Studio Pending Changes Question

I recently switched from a Java based project to a C#/.net project. I previously used IntelliJ which had the concept of change lists where you could group your pending changes together and check each group in individually.
I have two problems with the pending changes window in visual studio.
1) Every time I check anything in, visual studio checks the checkbox beside Every pending change in the list forcing me to uncheck each and every one of them so I don't accidentally check something in. This is extremely frustrating because there are several files that I need to keep changed to correctly run my code locally. Is there any way to change this default behavior to not check any pending changes on check-in?
2) Is there any way to group changes into lists as opposed one big bucket of changes? Again this becomes frustrating when I need to check something in, but I have to search through the files and check the pertinent changes. I understand that shelve sets exist using TFS, but that doesn't cut it for me, especially since I have several changed files that I need to keep altered in order to correctly deploy locally, and I rarely ever want to check in.
Thanks in advance!
I have to manage lots of changes every day in Visual Studio, and I've got a few tips for you, but no silver bullet:
Use Ctrl+A to select all items and then press a checkbox to toggle the checkboxes for all items. This can be useful when performing changes to only a few items -- just uncheck everything, then make sure you have only the items checked that you'd like to update.
Use Ctrl+Click (then right-click) to 'Undo' selected changes. By default, the undo action will only apply to the selected items.
You might want to experiment with using multiple Workspaces -- and then filtering changes by workspace or by solution.
No, I don't know of a way to fix your problems. It sounds like the best answer would be to refactor your configuration settings or code so that you can check in all of your changes.
If your changes are in different projects you can partition what you check in using the Source Control Explorer by right clicking on the project folder and checking in that way. It will auto check only the files in the folder you right click on. Just keep in mind the Source Control Explorer gives you some other options. Otherwise, I do not know of a way to manually control your change sets file-by-file thought if this exists I would like to know about it too.
You can also use Ctrl+A to select all items and then press Spacebar to toggle the checkedboxes as checked/unchecked.

Associate web page with project in Visual Studio

Is there any way to associate a web page with a project in Visual Studio, and have it load up in the IDE? For example, I have a project who's task list is maintained on a web site. It would be ideal to see those tasks within the IDE instead of a separate page. I can accomplish that now by following these steps:
Press Ctrl-Alt-R to open a Web Browser page
Change the URL to my desired path
Position the page as desired (like in its own tab group, off to the right of my code)
It would be nice to have a link somewhere in my project that I could click and open this page in the IDE without changing the URL every time. I have several different projects that would benefit from this. Any ideas?
Something like this happens with Visual Studio Team Foundation Server. The various documents and guidance associated with your current Team Project area accessible from within Visual Studio, in the Team Explorer window.
You can also create a Guidance Package to apply various commands and pieces of documentation at appropriate places within your projects. see Guidance Automation Extensions and Guidance Automation Toolkit.
Nice idea. The only thing that I can think of is via Visual Studio Extensibility. Basically,
Define an MSBuild property in the project file or a custom field in the solution file that has the project url.
Write a VS package that subscribes to the solution load event or something similar (I am not familiar with VS object model but I am sure there is an event like that) and looks for that custom field and extracts the url if it exists in the solution or the project file and then opens a web browser within VS that points to that url.
Here's my quick hack around this problem:
Create a text file in the project. I called my "notes.txt", and I use it to store notes, ideas, etc. that don't have a home elsewhere in the project.
Add the web link to the top of the file.
Open the text file in the IDE and put it in a new tab group. I put mine in a vertical tab group off to the right.
Drag the separator as far over as it will go to "hide" the tab group. This way it's always open and available but not taking up much space.
When you want the web page, "show" the tab group (i.e. drag the separator back) and ctrl-click the link.
This has the added benefit of opening the web page in the same tab group as the text file, so you can push them both aside when not using them.
I'm sure there's more that could be done by writing packages as others have suggested, but this was a low-effort way to get me close enough to what I wanted. I'd love to hear other suggestions or modifications that might make this setup better.

Resources