I have a solution structure like this:
Normally, I would like to debug 'SoundStudio.MainWindow' but it does not let me start that project:
Any Ideas?
You have to right-click on SoundStudio project, then select "Set as Startup Project"; in this way you should be able to launch your program and debug it.
Currently it seems you have set WaveFileLib project as startup project (please note the bold white text for its name); from the name I guess it is a library and an error message like "A project with an Output Type of Class Library cannot be started directly" should be prompted out when trying to debug it directly.
Related
here is my program
program hello
print *, "Hello World!"
end program hello
and it says to me
visual studio cannot debug because a debug target has not been specified
The way this normally happens is that you chose the incorrect project type - for example, a library instead of executable. If your project is properly building an EXE and you still get this error, right click on the project, select Properties. Then on the Debugging property page set the Command property to $(TargetPath). Otherwise, create a new project of the correct type (for example, Console Application
I have a C# project in Visual Studio which has several classes under it. I am trying to run each class separately but when ever I hit the start or debug buttons,only one of the classes (the first one I created) runs.I tried right-clicking the other classes but they don't have the run option. I am using Visual Studio Express 2013
Update (To clarify the question)
Under the Solution C-SharpTutorial i have two .cs files (ArrayTest.cs and Program.cs). What am asking is if it's possible to run these files separately. Right now, I am only able to run the Program.cs file which is the first one i created.
I assume that by classes you actually mean projects. Because one Solution contains one or more projects, and projects can be run.
The answer to that is here: http://msdn.microsoft.com/en-us/library/a1awth7y.aspx
To set a single startup project
In Solution Explorer, select the desired startup project within your solution.
On the Project menu, choose Set as StartUp Project.
Otherwise, please clarify your question.
Okay, i assume you have a console application. While you cannot "run classes", you can set a startup method: https://stackoverflow.com/a/49585943/1974021
A class is a set of methods. To execute (non-static) methods, a class must be instantiated. But the runtime does not know how to call an arbitrary constructor. Therefore, the program execution starts in a static method called "Main".
If multiple classes contain a suitable Main() method, you should be able to select the desired one according to the link above.
It sounds like you mean Projects, not Classes. To change the project that is executed when you start debug mode, you can right click on the project and select "Set Active Project".
If you set breakpoints in any of the other projects that are referenced, they will still be hit and you will be able to debug using Visual Studio.
If you need to run multiple projects, you will need to run these manually from the bin\Debug folder, and then use the "Attach To Process" feature in Visual Studio to attach the debugger to those processes so that you can debug them.
Update
No, you cannot 'run' two different classes separately. A console application has only one entry point. However, if you're learning C# and testing code, you can use a switch statement.
For example:
void main()
{
Console.Write("Choose Option (1/2):");
var key = Console.ReadKey().KeyChar;
switch (key)
{
case "1":
{
var arrayTest = new ArrayTest();
arrayTest.Run();
break;
}
case "2":
{
var anotherTest = new AnotherTest();
anotherTest.Run();
break;
}
}
}
This way, when the app runs it will prompt you for a key, and you can press 1 or 2 to execute whatever you want.
With that said, for writing basic test code, I find using LINQPad significantly more productive as it bypasses the need of writing all of the boilerplate console application code.
There are 2 Reasons
Every Class have their own Main() Method
2.C# has case sensitive so method name like Main() not like main() it won't show in project properties window
---->Kept as startup project under project properties-->> Application--->
select a project which u want run
There are two types of reasons for this:
Every class has their own Main() method.
C# is case-sensitive, so method names like Main() are not like main() and won't show in the project properties window.
Solution: Keep as startup project under project properties --> Application --> select a project which you want run.
I am trying to do the quick start example, I bring in the ref's using NuGet in VS2010, I scrape the sample code on the webpage, I see my NUnit Session window, I click the green arrow, but the browser doesn't get invoked (doesn't start). What am I missing?
using System;
using NUnit.Framework;
using WatiN.Core;
namespace FirstWatinProject
{
[TestFixture]
public class Class1
{
[Test]
[STAThread]
public void SearchForWatiNOnGoogle()
{
using (var browser = new IE("http://www.google.com"))
{
browser.TextField(Find.ByName("q")).TypeText("WatiN");
browser.Button(Find.ByName("btnK")).Click();
Assert.IsTrue(browser.ContainsText("WatiN"));
}
}
}
}
I am getting the following error in NUnit Sessions window;
SearchForWaitOnGoogle Failed: System.IO.FileNotFoundException: Could
not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0,
Culture=neutral etc...
Okay, solved the error, it is as the following other overflow thread concludes;
WatiN System.IO.FileNotFoundException Interop.SHDocVw
BUT, a key action in the sequence is to build the class library project AFTER setting the Interop.SHDocVw dlls' 'Embed Interop Types' property to 'False';
Then you can hit the green arrow in NUNIT Sessions window and you will see the IE browser startup after a second or two. Simply click it and you will see whatever actions you have programmed.
God is in the details!
Setting the Interop.SHDocVw, Microsoft.mshtml dlls' 'Embed Interop Types' property to 'False';
Of course Visual Studio would give you warnings on how to amend.
The Use of Nugget Package Manager
Check for the availability of Interop.SHDocVw.dll,
Make sure that your project has a reference to Interop.SHDocVw.dll and the dll is present in the Bin/Release Folder depending upon how you are running..
Just select Build from the main menu...then select Configuration Manager. In the list select you project and change its Plateform 'Any CPU' etc to x86.
If you have only Only CPU option, you can use ... option when chosing platform and create new setting, that is for X86 platform and then choose it.
ref:
Change target to x86 in VS2010
I already had a reference to Interop.SHDocVw. The easiest fix for me was simply changing .NET from 4.5 to 3.5 in Visual Studio settings. After making the change, it worked fine.
This is a pretty niche question, so I am not expecting a huge response...
Basically, I am learning how to use the UDK by following some tutorials, namely this one:
http://forums.epicgames.com/showthread.php?p=27043379#post27043379
So far everything is going pretty well. The only real hangup I've had is getting everything to work in Visual Studio 2005 using this nFringe plugin. For a long time, couldn't get them to work at all. I've gotten into two or three chapters of the tutorial, and I've managed to use Visual Studio to edit the code, but I can't build the scripts within VS; I have to go to UDK Frontend to do that. And worse still, I can only really use Log commands in the unrealscripts to debug anything.
So my question is this: is it even possible to configure these tools in a way that I can put breakpoints in VS and have them be caught when I test the game? I feel as though I don't have something setup correctly.
Yes it is possible. Here are some info which might be useful to you.
First, both your .sln and your .ucproj files must be located in Development/src. Then, under visual studio, right-click your project (.ucproj file in the solution explorer) and open its properties.
You must set, under the General tab:
Target Game: UnrealEngine 3 Mod
UCC Path: ....\Binaries\Win32\UDK.exe
Reference Source Path: ..\Src
Under the Build tab:
check "Build debug scripts"
Under the Debug tab:
Start Game Executable: ....\Binaries\Win32\UDK.exe
Load map at startup: the name of your startup map, without path nor extension
Start with the specified game type: put your GameInfo class used for your mod, ie. MyMod.MyGameInfo
Disable startup movies can be checked to gain time at launch
Enable unpublished mods must be checked.
In your command line, the parameter -vadebug specifies that the breakpoints will be enabled.
After that, you must be able to build your script from Visual, and launch your game by pressing F5.
Breakpoints should work but you can't put them on a variable declaration, you have to put them on a function call, an assignment or a condition statement.
Hope this will help.
I havnt tried using breakpoints yet but I know its possable to build with nfringe and visual studio . You need to add a line to the
udk game / config / udk engine .ini
search for
editpackages
exactly like that , then youll see a block like this
EditPackagesInPath=....\Development\Src
EditPackages=Core
EditPackages=Engine
EditPackages=GFxUI
EditPackages=GameFramework
EditPackages=UnrealEd
EditPackages=GFxUIEditor
EditPackages=IpDrv
EditPackages=OnlineSubsystemPC
EditPackages=OnlineSubsystemGameSpy
EditPackages=OnlineSubsystemLive
EditPackages=OnlineSubsystemSteamworks
then add your own line pointing to a folder named what ever you want but make sure it has a folder in it named Classes and it has the uc files you wnat to compile in it
ModEditPackages=MyTestProject
if you used that line then you are tellign udk you have a folder named
MyTestProject
located in your development/src folder and you want it to compile everything in there
I'd like to humbly ask: How can I debug a wince executable(.exe) that has been stored on the wince device, using Visual Studio's debugging facility.
As we all know, using VS2005, we can create a Win32 Smart Device Project(.vcproj),add our source files to it, compile, select a target device, and press F5, then the generated exe will be deployed to the wince device and gets attached to the VS2005 wince debugger. But I'd really like to know, if someone has a wince exe(call it stock) already in his wince-device and have source code corresponding to that exe, HOW DO I start debugging that stock exe directly WITHOUT compiling the source code? I cannot compile the source code perhaps because I'm missing some library source or other reason.
For PC program, I know I can open an exe as a project so to start debugging that exe. I can find the main() function and set a break point on its first statement, then F5 will stop at that break point.
Thank you in advance.
I often run into this problem as well; I wish the "exe project" created would allow changing the debugger to "Smart Device Native Debugger" (or somehow set the platform) -> Let me know if someone knows how to do that.
The two ways I have been able to work around this are:
New Project Method:
Create an empty "Smart Device" project with no source code.
Change the "Configuration Properties > Debugging > Remote Executable" to your "Stock EXE" that you put on the device, ie: \FlashDisk\MyApp.exe
F5 to debug, and choose "Yes" when it says "deployment errors, do you wish to continue".
Attach to Process Method:
Same as above, but, instead of editing "Remote Executable" just start the "Stock EXE" via rapistart.exe / running manually via screen. Then make sure the "Attach to Process" transport is set to "Smart Device" and you should be able to attach.
After this you need to manually load the pdb, choose src files, etc, as you would a normal PC app.
If you want to debug a .NET CF managed application then the following link should help:
http://msdn.microsoft.com/en-us/library/b1ksfbk7%28VS.80%29.aspx
I only used managed .NET CF but I found this link that has loads of goodies on how to debug both managed and native code on a Windows Mobile 5 in VS2005. Most of it should apply to Win CE as well:
http://msdn.microsoft.com/en-us/library/aa446524.aspx
I figure out the method lately after going through quite a lot of reading and experiment(so many tricky points that Microsoft does not clearly document). user2093823 kindly summarized the procedure.
Some historical screen shots: