I've only used Visual Studio a handful of times.
Can I make an executable with a custom icon that strictly opens a URL in a web browser?
I am assuming Visual Studio will be the best tool to help me achieve this, although I am open to better options.
It has to have a custom icon and be a stand alone file.
Thanks.
if you don't need it to be an executable you could quickly create a windows shortcut.
http://support.microsoft.com/kb/140443
You can personalize the icon too.
As PrashantGupta has pointed out you can only use a subsets of windows icons if you want it to be a single file.
Sure,
Just write a single line console app with this as your code
System.Diagnostics.Process.Start("http://my.url.com");
You can configure an icon from within visual studio easily too.
Sure, did I get this right: You need an EXE with custom icon and launches a URL?
If you choose C# as your development language the following code will achieve what you want:
namespace URLLauncher
{
class Program
{
static void Main(string[] args)
{
System.Diagnostics.Process.Start("http://www.google.com/");
}
}
}
Changing the icon is also quite straightforward in visual studio as well. See this: Adding an icon to my finished application
Also try not to make your application a "Console" application as that will pop up a "black console window" when you launch the app if you need a double-click interface from the user (which I infer from your wanting an ICON).
Hope this helps.
If you decide to go the C++ route, passing a URL to the ShellExecute function will let you launch a website using the user's preferred browser.
See http://support.microsoft.com/kb/224816
And you don't really need anything from the C or C++ runtime for this, so compile with /NODEFAULTLIB use the /ENTRYPOINT linker option to skip all that, make your executable truly tiny, and have very few dependencies (meaning none that aren't included in every version of Windows since 95). It'll start faster too, not needing to run .NET or any library initialization code.
Add your icon in the usual way using the Resource Compiler.
Solves the problem, not necessarily with the requested tool
While we are at-it, so to speak, I thought someone must have invented this wheel before, so if you are not interested in any development what-so-ever (check licenses before use tho), here are some online tools to do what you want:
Web shortcut producer
Remember to scan the EXE for for malware. Hope it helps :-)
The Visual Studio route has a lot of advantages and will work for this situation. Although, it is overkill for the project I am working on.
I have chosen to go with this solution:
Build a .bat file with the command:
start http://www.google.com
Then use a bat to exe converter which allows icon assignment.
Worked like a charm and quick.
Related
I'm sure this has been asked and answered, and I apologize for that, but I'm not really even sure what I'm looking for or need to do. I'm an electrical engineer that can play with programming, but when it comes to servers and remote stuff, I get really lost.
Anyway, here's the stick. I'll try to be specific.
I'm not sure this part matters, but I'll try to explain for clarity's sake. We are developing a machine. This machine is run by an IPC. The IPC is basically a PLC that has embedded Windows 7, and the IPC itself is programmed with Structured Text which is written in VS2013 (doesn't work on newer versions). In order to 'activate' the programming and parameters that we set in VS2013, this computer must be connected to the machine with an ethernet cable. I can also remote in to manually control the machine from this computer.
For an operator to control the machine in general, a CS major wrote a program that we call the HMI, or Human Machine Interface. I access and update the code for this, which is written in C#, through VS2017. The project is set up as a solution, and in order to 'activate' this programming after making changes, I just build the solution and copy the dll file over to the machine, through the remote interface. On that machine, we just click an executable that starts the IPC and then I'm guessing the IPC has been linked to the HMI program, because that opens shortly after that.
Ok, now, I'm trying to implement a new feature into this HMI and I'm running into some unknown error. In order to correct this with any program I've written in the past, I would normally set a breakpoint and/or run the debugger and go through step by step until it breaks. However, since this program has to run in tandem with the IPC, which it passes values to and receives output from, it's more complicated than that.
The CS person I mentioned no longer works here, but his note says that the debugger can be run as long as I'm connected with the ethernet cord I mentioned. When I try, though, I get "A project with an Output type of Class Library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project."
Now, from googling, I've found and tried to set the solution as a startup project, but it didn't seem like anything happened when I selected that, and furthermore, the error persists. I'm guessing that I need to do the latter, which is to 'add an executable project to the solution and set that as the startup project'... but I really don't know what that means, at all.
Do I 'add an existing project' (under File)? If so, would that be the project/solution from VS2013?
Or do I somehow need to add the executable that we click on the machine?
I sound like an idiot, I know, and that's because I am when it comes to this stuff, haha. It may be too complex for anyone to even attempt to answer, or so simple that I'm way overthinking it. I have no idea at this point, and I'm desperate.
That said, I would really appreciate if someone had any idea. Regardless, thank you for your time.
You can debug an executing process by using Visual Studio's Attach to process tool which is in debug menu. This will attach your source code to an executing process as long as the code and process code match.
How do you print or output text in Monogame?
I googled how to display text in monogame and was led to this:
Debug.WriteLine
Which says: "By default, the output is written to an instance of DefaultTraceListener."(and that page just confused me more).
So, if someone could direct me to a method of displaying DefaultTraceListener, or another method of outputting text in monogame, I would appreciate it.
I found it!
Using Debug.WriteLine writes to the debugger, which is in the output window in Visual Studio(by default at the bottom). It appears when you close the program(press F5 to start, Esc to close) by default in an OpenGL project.
If you like, you can use Console.WriteLine like you would in a normal C# console application, assuming you're developing a desktop application. There are a couple of steps.
Open the Properties for your MonoGame project
Select the Application tab
Change the Output Type to Console Application.
Your application should run as normal, only a console window should appear when you start the game.
Alternatively, you can use Debug.WriteLine, which will write to the output window in Visual Studio (it should appear when you start debugging your game).
If you use the standard Debug.WriteLine or Trace.WriteLine, then output goes to the default trace listener which can be viewed in the Visual Studio output window. Outside of Visual Studio, you can use programs such as DebugView (SysInternals) or LogFusion (Binary Fortress) to display the output. DebugView even has a feature for viewing debug output from a remote machine.
There are other trace listeners that can send output to a file, or to the Windows event log, or you can write your own trace listeners fairly easily.
You could also consider using a ready-made logging framework such as NLog, which would give you a great deal of flexibility. I have found in practice that using NLog turns out to be a lot easier than the built in stuff in .NET, because of the way it lets you easily reconfigure things and control/filter the output in a much more flexible way.
I know this has been answered, but if anyone else stumbles upon this, you can also use Console.Write(thing in here); or Console.WriteLine(thing in here); to write to the console window. WriteLine adds a line ending and Write does not.
I'm generally a C++ guy, but I've got to switch to C# some of the time in order to build things for the "Windows Phone" platform. Or when I have to go to work. Whatever. Point is, I work very differently when I'm in C++ than when I'm in C#.
I'd like to have a quick and fast way of switching between these two. I know there's a "save all settings" and "restore all settings" bit, but it's awfully slow to fire up the IDE using the wrong settings, reload the other settings, close the IDE back down again, and then restart it. Ideally, I'd like to key these settings based off what kind of project I have open. E.g. if a C++ project exists in the solution, use C++ settings, otherwise use C#/XAML settings.
Does such an extension exist?
Not exactly an extension, but take a look at this blog post by Sara Ford: Did you know… You can create toolbar buttons to quickly toggle your favorite VS Settings?
I am designing a basic app with multiple forms I seem to be coming across this problem and it will probably be something stupid.
When I make a change to my main form in design mode (like add a button), the button appears in design mode and I can code it but when I build the program it doesn't show up.
Any ideas?
Clean and Rebuild
Make sure you're you're starting a correct form in Application.Run in Program.cs
Most Important of all ..
Save your changes !
And make sure that the build compiles (it might not compile and not ask you if you want it to run the last successful build).
Check out what Microsoft themselves say:
http://vidmar.net/weblog/archive/2005/02/04/999.aspx
The problem was resolved. Just go to taskbar> build >clean rebuild.
Some questions:
If you change the code-behind, does the debugger stop on a breakpoint you put on that change? Also, declare a dummy variable and check if it is visible through the debugger windows such as "Locals", "Autos", "Watch" or "Immediate"?
Did you tamper with Form's default constructor (add parameters, change visibility, that sort of things)?
The form you are changing - are you positive that it is actually a main form (check the Program.Main)?
Does your form include user controls?
Did you try restarting the Visual Studio?
Did you try a full rebuild?
Did you try manually deleting all bin/obj folders then rebuilding?
Is your project actually selected for building under current configuration/platform (investigate the Build check-box under Configuration Manager)?
Did the project successfully build (check the error log)?
Are you running the same configuration/platform that you are building? Are you running the same project that you are building?
Ensure the right project is bold in the Solution Manager or check the start-up project in Solution Manager.
Do you happen to use "Start external program" under debugging options?
OK, this is not exactly an "answer", but answering these questions may produce some clues as to where is the actual problem...
Edit-And-Continue is one of my favorite debugging tools which I have previously used on C# based Winforms and ASP.NET projects. However, I'm running a Silverlight 3.0 application on VS 2008 and whenever I try to make a change (after breaking) it says "Changes are not allowed when debugging Silverlight applications". Also there isn't an "Enable Edit and Continue" option in the project settings.
Does anyone (possibly an insider) know when this feature will be supported by Microsoft???
(I NEED IT!)
I doubt it will ever be a feature, to be honest. EAC has always required you to attach directly to your .exe in order to work. In the case of Silverlight, that .exe is the browser, which is not the .exe you are developing.
If you are looking to edit XAML while running, you might consider a dynamic loading situation where you can refresh the control at runtime. In that case, you can edit XAML while debugging, but I'm afraid you're stuck with the managed code.
EDIT:
One possibility that you might consider (but I haven't tried it) is to write your code against unit tests. Then, there is a tool called TestDriven.net that allows you to debug your tests with EAC (as an advanced feature). From there, you might be able to do some EAC, but you will be doing it via unit tests, not actually in the Silverlight environment.