Is it possible to make hyperlink to visual studio instance - c#

Is there any way to make a hyperlink from a website which would open visual studio and find a file / find a class in a project or so?
We have some code review protocols where there are names of the classes to review and it would be nice if you could just click on the link and it would lead straight into the visual studio instance.

You have to write a program that installs a URI protocol like vs://C:/Projects/myproject.sln&class=Class%20A that would open the Solution myproject.sln as described in http://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx!
With this sheme you have to register to open another manual written program (clicked on a vs://-link) to start the devenv process with some parameters. Take a look at this to get some more information about "Opening a file in a project from the CMD".
Conclusion: There is no way to do this without installing a program and a macro in Visual Studio.

You can check devenv.exe start up switches(parameters) here:
http://msdn.microsoft.com/en-us/library/xee0c8y7(v=vs.90).aspx
http://msdn.microsoft.com/en-us/library/19sf6kk3(v=vs.90).aspx
Also you can use ActiveX to run CMD commands to invoke the devenv:
How to Run cmd.exe with parameters from javascript
I hope this helps :)

Related

Avoid getting "File Modification Detected" message Programmatically

Hi I am developing an visual studio extension where once the solution is open and I try to add a new project using a command after creating that project this msg pops up saying modified outside the environment. Does anyone have solution for disabling it.
I know what you are talking about, I can reproduce.
Based on the default settings of VS Tool, if you use such commands in root directory of the solution file outside VS:
dotnet new console -n ProjectName -f net7.0
dotnet sln SolutionFileName.sln add ProjectName/ProjectName.csproj
And then, if you click in the entire window of Visual Studio, this windows will pop out:
For your situation, currently doesn't have such feature to control 'File Modification Detected' Window when projects be linked to solution file outside.
Your requirement make sense, I suggest you to rise a feature request ticket in Microsoft Official feedback place:
Request a feature
you can share your ideas and your requirements there.
By the way, there is a public extension project in GitHub, which can kill the 'File Modification Detected' window and auto load the solution:
FDMKiller
This extension is based on VS2017, it may not be suitable for your VS version and may not be able to use directly in your VS version, but you can get some inspiration from the source code if you are interest in this.

How to embed the version information in the executable file name when building C# application in Visual Studio?

This question is a complement for the post How to change the output name of an executable built by Visual Studio.
After reading this post I did the following:
Firstly, I followed the answer for this post and I could define the executable file name successfully.
Now, I would like to know if instead of only define the name as "Demo.exe" as mentioned in the example post above, it would be possible to embed the version defined in AssemblyInformationalVersionAttribute or in AssemblyVersionAttribute in the built file, resulting in something like "Demo_v1.0.0.0.exe"?
I'm developing my application in C# WinForms, using Visual Studio Express 2017.
Why would you want to change the name of the executable? Whenever you try building a Setup for your application, you need to change the Setup to include the new file. And when you install an update, your Setup needs to know all versions of your executable in order to delete the old version. That's just not what you want to do.
If you want to keep all versions of the software for yourself, come up with a different solution, e.g. moving the executable into a folder which has the version number.
That said, I have done this for Setups, so customers can download different versions of the Setup. I did that using a commercial tool called Visual Build, but there are other build automation tools available. So, my answer is: set up a continuous integration / continuous delivery pipeline (CI/CD) and automate the step there, not in Visual Studio.
From the project properties, you can add Post build event command line to rename your exe
pseudo
Maybe you can create another console renamer.exe which reads version defined in AssemblyInformationalVersionAttribute or in AssemblyVersionAttribute of your app and renames it and then call that renamer.exe from Post build event command line
write a powershell script to rename the newly built exe and call that script from Post build event command line

Merge two versions of C# projects

I am working on documenting a winForms project that isn't completely done being written, meaning there is another programmer who write the code right now. So I've already wrote some importent comments in a copy of the project.
In addition I use sandcastle to bulid the help file.
My question: what is the best way (if there is one) to copy the comments from the old copy of the project to the new version of it?
Maybe sandcastle can do something like import a documentation to a project?
I know it wasn't so smart to do so, still I have to check if there is a way to save the documentation work.
Visual Studio has a built in file difference function you can use to see where the two files are different. It should be then a matter of copy and paste of the changes you have made over to the "gold" copy of the file your other programmer has changed.
This link shows how to Compare two files in Visual Studio 2012
"You can invoke devenv.exe /diff list1.txt list2.txt from the command prompt or, if a Visual Studio instance is already running, you can type Tools.DiffFiles in the Command window"

Trying to launch a Visual Studio C# program from inside another one

I am having great difficulty getting a Windows program, written in VS 2008 C#, to launch another type program. I've put a main program to offer you the ability to launch some other VS 2008 C# programs. When one of them is selected the following code is intended to do the launch:
System.Diagnostics.Process.Start(#"C:\Documents and Settings\rat\My Documents\Visual Studio 2008\Projects\PV_002_082708\PV_001\PV_001\bin\Debug\PV.exe");
It works, but each user will have a different path. The path shown is for my computer. The code would have to know where each persons program was installed! In the past, I could easily call a program that was in the C:\Program Files location because that's where the MS Package & Deployment program put the programs. VS 2008/2010 doesn't put them there!
I'm sure I am not knowledgeable about Visual Studio 2008/2010 to know if there is a way around this, so any help would be greatly appreciated.
System.Diagnostics.Process.Start(System.Io.Path.Combine(System.Windows.Forms.Application.StartupPath, "PV.exe"));
assuming that the program is in the launched application's path.
or...
System.Diagnostics.Process.Start(System.Io.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), #"Visual Studio 2008\Projects\PV_002_082708\PV_001\PV_001\bin\Debug\PV.exe"));
assuming you want to open the project from it's place.
Once you create the installation package you can set the install path to some fixed path that users will not be able to change and than use that from your code (not very user friendly but it would work) or insert the user chosen path value into the registry and get it from there instead.
May want to have a look at this thread. How-to as well as lots of pro's and cons.
Embedded a *.exe into a dll
If you see the first answer to his question, I think this would work for you.
Simply he is saying, you add a resource file to your project, then when the user runes your program, it extracts your exe file that you added as a resource file to somewhere you know on the end users maching.

What is the appname.vchost.exe file

Every time I build my .NET application with Visual Studio, I got a appname.vchost.exe file along with my appname.exe file. This file doesn't exist when I build with command line commands. So,
What is this *.vchost.exe file for?
Could someone explain its working mechanism in detail?
Thanks.
I assume you're talking about the VS hosting process. It is used for
Improved Debugging Performance
Partial Trust Debugging
Design-Time Expression Evaluation
You can turn it off in the project settings. If you want to change the project settings template once and for all please see this question.
Its a version of the application used by visual studio to allow you to debug your application, if you clean your solution and build in release mode it will not be there.
Cheers

Categories