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.
Related
I work on a solution with both managed (C#) and native (C++) code. The managed code calls into the C++. I typically have native code debugging disabled because it makes the whole experience slower but I have many times where I need to enable it.
Unfortunately the process is cumbersome:
Right click on project.
Choose "Properties".
Choose "Debug" category.
Click "Open Launch Profiles UI".
Scroll down.
Click the "Native Code Debugging" checkbox.
I wanted to make this faster. I was hoping there might be some command for it that I could bind a key to. I tried going into Tools >> Customize and searching for a command that had "Native" or "Managed" in it. I didn't find anything that was like what I want.
Does anyone know a faster way to toggle this setting?
You can create a launchSettings.json file and it would look something like this:
{
"profiles": {
"NameOfYourCSharpProject": {
"commandName": "Project",
"nativeDebugging": true
}
}
}
I verified you can do this even if your project is .Net Framework; though you'll have to first you want to convert your .csproj over to SDK style if it isn't already. It is to be put in the Properties directory of your C# project.
So if you find yourself toggling between wanting Native Code Debugging on/off I suppose you could make two executable projects one with this setting in the launchsSettings.json file and the other without. And toggle between start-up projects. Or something like that.
Answering my own question here. I am not sure if this has been in Visual Studio for a while or if they recently added it but I had not noticed it before. Turns out a much faster way is to go to the Debug Menu and choose the very last item.
"(Your Project Name] Properties"
That takes you right there. Still no hotkey but much better than the multi-step way I've been doing.
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.
Visual Studio has a feature called Custom Tools. The Custom Tool will run every time I save a file or, if I click the "Run Custom Tool" menu item. Is there a way to make it run only when I click the Run Custom Tool menu item?
I don't believe there is any way to discriminate from within the custom tool code. This may be stating the obvious, but it sounds like a normal VS add-in would be more appropriate in your case.
In my Visual Studio extensibility project, I'm attempting to make my tool window visible upon launch after package installation.
The dotneteers describe a way of doing this that involves adding the following line to the package header (i.e. MyPackage.VSPackage.cs):
[ProvideToolWindowVisibility(typeof(MyToolWindow), Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.NoSolution)]
Unfortunately, this doesn't work. It seems that Visual Studio doesn't pay attention to the "NoSolution" tool visibility directive (I can confirm that it does work for some of the other enumeration items, like Debugging, but this doesn't fit my use case).
If there's no way to make this auto-show the tool window on VS load, has anyone come up with any alternate (i.e. novel :)) solutions?
Alternatively, you can try making you package as auto load using ProvideAutoLoad and once at the Initialize() try to create this tool window. Use the Package.FindToolWindow() method.
Unfortunately it looks like for various reasons I'm going to have to use Visual Studio 6 instead of a newer version of VS.
It's been a long time since I've used it. I'm looking through its menus and don't see any obvious way to set up any custom build steps (pre-build, post-build, pre-link... anything would help actually).
Can anyone give me instructions on how to set up steps like this?
Open your project, then open the Project Settings screen (Project → Settings or ALT-F7). Alternatively, right click on a file in the FileView and select Settings.
From the Project Settings screen, go to the General tab and check "Always use custom build step". This means that the file you just chose will be an input file for a custom build step. From the "Custom Build" tab you can then give the commands to run and specify what files will be generated.
For pre-link, post-build and such, select an executable (or library) from the Project Settings screen. Then use the little arrow button to scroll to the rightmost tabs. From there you'll find the Pre-link and Post-build steps.
It's quite simple, really, I'm sure this is enough to get you started.