I hope someone can point me in the right direction. I have two separate piece of code that functions outside of Visual Studio.
The last step performed by the second piece of code currently creates a new c# source file. I would like to combine both pieces of code into a single VSIX extension.
Unfortunately I have never worked with VS Extensions and I am a bit lost. I have worked through various VSIX examples, but none of these create files.
Can anyone perhaps point me to a working example of how to add new source files to a project via an extension?
I have seen some examples, but they all refer to old Add-In style plugins and not VSIX.
Create a VS 2017 extension to add new code file
As we know the Visual Studio Extensions is:
Extensions are add-ons that allow you to customize and enhance your
experience in Visual Studio by adding new features or integrating
existing tools. An extension can range in all levels of complexity,
but its main purpose is to increase your productivity and cater to
your workflow.
So, the Visual Studio extension is service for Visual Studio IDE to customize and enhance your experience in Visual Studio, rather than serving a specific project.
What I suspect the Project and item templates should be helps.
Hope this helps.
Related
I'm sorry if this question has been asked before but I couldn't find an answer so far.
Let's say I have a asp.net mvc5 project, and I have included a external script file in my cshtml file using razor.
like so:
<script src="#Url.Content("~/Scripts/Path/File.js")"></script>
is there any way to easily open that file from the include statement? Or is there a different way to include the script that would allow such functionality?
plug-ins are also welcome.
Thanks everyone.
I don't think there's such extension nor feature in Visual Studio unfortunately. There'are extension for Visual Studio Code (e.g. Open file), but not for the "big" Visual Studio.
You can try to create your own extension to do that, it shouldn't be so complicated.
Or you can try to create a feature request on UserVoice and wait if it's accepted and implemented.
Is there a way to have linked files in an ASP.NET 1.1 project?
What I did was to copy the linked file declaration from a DLL csproj to the file I want. But everytime I change the Web.csproj to add a new file, the links are deleted.
Is there a possible workaround? maybe inserting this in the build scripts or something like that?
Is this possible in .NET 2.0?
If you are using Visual Studio 2003 then linked files are not supported:
If you want to explicitly add an item as a link, you can create links
in the following projects:
The solution, Visual C++, and other similar projects support only links, so all of the items in these projects are links. The project
does not attach a link indicator (a small arrow) to the item icon in
Solution Explorer.
Visual Basic, Visual C#, and other similar projects can accommodate both linked and physical project items. Linked items in these projects
display a link indicator attached to the icons of linked project
items.
Visual Basic Web, Visual C# Web and other similar projects, do not
support links to items
http://msdn.microsoft.com/en-us/library/9f4t9t92(v=VS.71).aspx
You can work around this by creating a symbolic link (symlink) to the first instance of the file. The Link Shell Extension makes it easy to do so in Windows Explorer and it will even add an arrow badge to the file's icon (you have to use NTFS). Or use the command line program mklink:
> cd Project\Properties
> mklink AssemblyInfo.cs ..\..\Global\AssemblyInfo.cs
When you have created a symlink, it's as if the same file exists in both places. It's transparent to applications, including (I expect) Visual Studio 2003. This is not the same as a shortcut (.lnk file).
UPDATE: what I did in the end was to take another approach. I simply put a validation in my build script that if the csproj does not contain any reference to my AssemblyInfo files, the build failed.
This was ok because the only time they would be deleted, is when the csproj gets modified which is almost never.
I have a big project I am working on right now using Visual Studio 2008.
The solutions is composed by several project in Visual C# and Visual C++.
Clicking on a project node , and selecting from the manu the item "Project Dependencies" I can find the list of dependencies I want to export.
Do you know a way to export this list on a file someway?
Thanks
EO
They are already stored in the Visual Studio Solution and Project files.
Look for the <ProjectReference> tag.
With some post-processing, you could copy them from there and write them to another file.
You can also use the EnvDTE.BuildDependency class to retrieve the dependencies programmatically.
If you mean Project Dependency as opposed to Project Reference, the former just imposes a build ordering, they are stored in the solution file. Look for lines like
ProjectSection(ProjectDependencies) = postProject
I have an old project that uses MPXJ library to access MS Project 2010. However it doesn't get the files save as Project 2010 format even if I uses the latest MPXJ 4.0. What else do I need to do to get the files of that format? I've searched MPXJ website but there seems to be no document about the changes and a tutorial to modify existing codes.
you should not need to make any changes to read Project 2010 files. The MPXJ API has not changed significantly with the 4.0 release: there are a few new Task and Resource attributes. If you are using the "presentation" information from the MPP file, you'll find that colors have changed from being represented by an enumeration to being Java Color types. That's pretty much it.
If you are still having specific problems reading Project 2010 files, feel free to raise a bug at SourceForge, or drop me a note directly.
Cheers!
Jon
Disclaimer: I maintain MPXJ
I have nUnit installed.
I have VS2008 Team Edition installed.
I have ASP.Net MVC Preview 4 (Codeplex) installed.
How do I make Visual Studio show me nUnit as a testing framework when creating a new MVC project? At this point I still only have the Microsoft Testing Framework as a choice.
Update: I installed nUnit 2.5, but still with no success. From what I've found Googling, it would seem I need to create templates for the test projects in order for them to be displayed in the "Create Unit Test Project". I would have thought that templates be readily available for nUnit, xUnit, MBUnit, et. al. Also, it looks like I need to created registry entries. Anybody have any additional information?
Update: I determined the answer to this through research and it's posted below.
After a bunch of research and experimentation, I've found the answer.
For the record, the current release of nUnit 2.5 Alpha does not seem to contain templates for test projects in Visual Studio 2008.
I followed the directions here which describe how to create your own project templates and then add appropriate registry entries that allow your templates to appear in the drop-down box in the Create Unit Test Project dialog box of an MVC project.
From a high level, what you have to do is:
Create a project
Export it as a template (which results in a single ZIP archive)
Copy it from the local user's template folder to the Visual Studio main template test folder
Execute devenv.exe /setup
Run regedit and create a few registry entries.
So much for the testing framework selection being easy! Although, to be fair MVC is not even beta yet.
After all that, I did get the framework of choice (NUnit) to show up in the drop down box. However, there was still a bit left to be desired:
Although the test project gets properly created, it did not automatically have a project reference to the main MVC project. When using Visual Studio Unit Test as the test project, it automatically does this.
I tried to open the ZIP file produced and edit the MyTemplate.vssettings file as well as the .csproj project file in order to correct the aforementioned issue as well as tweak the names of things so they'd appear more user friendly. This for some reason does not work. The ZIP file produced can not be updated via WinZip or Win-Rar -- each indicates the archive is corrupt. Each can extract the contents, though. So, I tried updating the extracted files and then recreating the ZIP file. Visual Studio did not like it.
So, I should probably read this as well which discusses making project templates for Visual Studio (also referenced in the blog post I linked to above.) I admit to being disappointed though; from all the talk about MVC playing well with other testing frameworks, etc, I thought that it'd be easier to register a 3rd party framework.
Man, they have VS 2008 project template listed in their release notes. I guess that doesn't mean they have it integrated with the dialog yet.
I use MbUnit with Gallio and everything worked like a charm. I had to install an Alpha of Gallio and MbUnit and when I read the above in the release notes, I figured they implemented it also.
Just keep a look out on nUnit's site for future alpha releases. I am sure they'll have it implemented soon. You could also implement the feature yourself and submit a patch. :-)
Although they do not have one bundled with the framework here is a link to post containing a download to automatically create the test project for "NUnit with moq" for you NUnit with Moq
(did not work right away on my computer, W7 Beta, make sure you use elevated permissions)
Do install Testdriven.net to integrate NUnit with Visual Studio. MbUnit and later versions of NUnit also contain project templates for unit tests.
You can use those project templates to create a test project and then reference to your ASP.NET MVC project and be able to test its code.