Visual Studio 2005 Basic Knowledge - How doing debugging on C# codes - c#

My knowledge is very limited on VS in fact it's the first time I am using it and very little I know of C debugging too.
I have pre-existing .c and .o files that have been transferred into my folder and I open VS to edit them. I then compile on a unix windows with the icl command. What I get is obviously error messages because those files have been run in Linux compilers and never into Windows ones.
In blogs I always find mention to changing project properties when it's about resolving, i.e. _CRT_SECURE_NO_DEPRECATE warnings or other types of errors. My problem is that I don't see those .c files as projects when I open them from VS so I cannot change those properties.
Do I have to turn them into projects? Or do I have to simply move them into folder where VS opens files from by default?
Help is needed, please.
Thanks
F

You cannot use .c file in a C# project, it is a completely different language. Forums cannot really provide you with a short-cut for basic knowledge and skills you'll need to acquire to bring this project to a good end. You'll need to take the time, experiment, read a few books.

This is a quess. This assumes that your code is not dependent on anything.
You should create a C project (you may have to use empty project)
Add your c files to the project.
Right click solution and hit build.

Related

Intellisense not working for unit test project in Visual Studio Professional 2017

I'm working on a Visual Studio solution using Visual Studio Professional 2017, the solution consists of four types of projects:
Several C++ projects
A C# project
Several C++ unit test projects
A C# unit test project
IntelliSense seems to be working for all, except for (at least) one of the C++ unit test projects, and it goes even further: for some tests inside that particular C++ unit test project, IntelliSense is working, but for some other, it isn't.
As mentioned in other Stackoverflow posts, I've already removed the *.cache files and there are no *.ncb files (so I can't remove them :-) ).
I also consulted the MSDN website, as proposed by Visual Studio:
Intellisense: 'No additional information available' (See 'Troubleshooting Intellisense in C++ Projects' for further help.)
I typed the mentioned sentence in MSDN search (learn.microsoft.com), and I got 229 results, which looked useless, and I got 0 results while searching for the exact phrase. :-(
Another approach : in my Visual Studio settings, I've maximised the messages, sent to the output window, I've rebuilt the whole solution, and afterwards I looked for the word IntelliSense in the output window. There was nothing. Then I typed something in order to launch IntelliSense, I verified the output window, but nothing was added.
In order to solve this problem, I need detailed information about IntelliSense itself:
I believe that IntelliSense is based on some files. Which ones?
I also believe that IntelliSense is keeping its own information in memory. Is this correct, is there a way to store this memory mapped information in files? If yes, which ones, and how can I force IntelliSense to refresh its information?
Whatever IntelliSense is doing (filling its information in memory, saving it in files, retrieving its information from those files, ...), what can I do in order to log those actions, so that I have an idea what might be going wrong?
In other words, does anybody have background information on the IntelliSense background task, which might explain what's going wrong, and how I can derive (from information in output window or other) what to do?
Thanks in advance
You can try resetting Visual Studio once
Devenv /ResetSettings
Sometimes Visual Studio has these gnawing bugs that just stresses you out for no reason.
Remove the hidden .vs folder from your solution. That would trigger index rebuilding.
Also you can try to install recent update for Visual Studio 2017, they seem to work actively on improving the indexing.

C# code snippets not working after VSIX install

We've created a number of C# code snippets. If I import them directly using the Code Snippets Manager they work perfectly as intended.
Since we are going to have people rolling into our project at different moments in time we want to ease the on-boarding process so we want to include these snippets into a VSIX project. For that purpose I followed this process to the letter.
Now there are several issues going on:
1. When I run the VSIX in debug mode I get the experimental instance of visual studio but the scripts' folder is not in the manager and the package does not seem to be installed when I look in the "Extensions and updates".
If I close VS and run the VSIX installer, after re-opening VS I can see the package installed in "Extensions and updates", I can see the custom scripts' folder in the scripts manager and all the scripts are there but, when I open a code file and try to use them they are just not available, the short cuts are not recognized and the scripts are not available in the insert script context menu.
We have tried both approaches in three different environments and the behavior is the same.
We are using Visual Studio 2017 with .Net Framework 4.7.1
I have tripled checked all the settings, made sure there aren't any typos, all the files that need to be added are there in the right place so I do not know what else to check or try.
I am sorry that I do not include any code but there are some things that are deemed confidential but I tried doing it with the Hello World example and I got the same result.
Thank you for any help you can provide.
So as it turned out, there were multiple causes for this behavior.
Environment 1: With the brand new instance of Visual Studio 2017 there was a folder in the Snippets Manager named %LCID%. Within this folder there were two snippets specifically for MVC 4 applications. We do not know why but either these snippets or the folder was preventing our custom ones to be detected, once we removed this folder everything started working as expected.
Environment 2: This environment did not have the %LCID% folder but had ReSharper installed on it and it was configured to use the IntelliJ keyboard schema. As soon as we changed it to use the Visual Studio one then the snippets became available.
Environment 3: In this one the %LCID% folder was not present and the ReSharper keyboard configuration was set to Visual Studio. We disabled ReSharper and the snippets would still not be available. We basically were never able to figure out why the snippets were not available so we ended up going to the file system, cutting them from the custom folder and pasting them under the "My Snippets" default one and they became available.
Hopefully this information will be useful for someone or, even better, somebody might be able to explain why situations one and three would cause the snippets to not be available.

Which Windows IDE to write, execute and debug single-file C# programs?

I use Visual Studio 2010 for C# development. But, there are many times during the day when I need to quickly try out a small bit of C# code to experiment or learn something new. I can write this as a fully functional C# program in a single file. Now, I can use Visual Studio for writing/editing this C# files, but it does not support execution or debugging (breakpoint, watch variables) unless I create a solution for it.
I would like to have the ability to create, edit, execute (and hopefully debug) single C# files, without having to go through the pains of creating a VS solution everytime I need to try something. Is there a simple C# IDE on Windows in which I can do this?
The IDE should not create any project/solution files. That way I can have a directory of C# files, each of which is a full C# program and each of which I can open to read, edit and execute with this IDE anytime I want.
LinqPad can execute expressions, statements, or small programs that could be a single file in size (also see this page). It does not create projects/solution files just as you are seeking. Just open, code, and save if you like. I use the free version to test code I post on this site.
It supports .Net 4.0 and has some other nice features, such as not needing to explicitly specify using statements. The program is smart enough to know which ones you need.
Try Snippet Compiler
In the next release of C# and Visual Studio, one of the new features is Project Roslyn, a compiler-as-a-service implementation. The upshot is that this enables is scripting in C#, with .csx files. The Visual Studio blog has a lot more information on .csx files here.
I myself haven't played with .csx files much, but they seem similar to .fsx files for scripting F#, in that you take the code that you would normally place inside a method (in F#, a function) and place it at top-level, and can use the hash to introduce compiler directives (e.g. #r to reference a DLL).

Add New Filter functionality in C# projects

In C++ projects in Visual Studio 2008 there is possibility to Add -> New filter which will be usefull if one wants to separate some files from others (ie. source files from header files) and keep each type in "semifolders" without moving them physically on the hard disk. I wanted to do the same in c# projects with, lets say xml files, but the only option here is to create folder physically, which I want to avoid. And there are my questions:
Is it possible (and how) to create filters in C# projects?
Why C# and C++ project's Add options differ from each other (in first you can add folder(not filter) and in second filter(not folder)?
ps. I am using VS2008 and I don't know if this changed in VS2010.
As far as I know it is not possible to create filters for use in C# projects. The projects in C# are organized with the use of actual folders on your hard drive. Sorry. As for why C# and C++ have different options, well that is simply because they are different languages. C# is a more high level language then C++ so (I am only guessing) they went with folders to make it more visible what is going on in the project.
In C# you can group files together:
To do that you will need to install free extension VSCommands 2010 or VSCommands 2008
sadly: No 'Filters' - in MSBUILD that C# Projects use.
Possible work-around is to have a real Folder that contains symbolic links to the handpicked files you seek to group.

Do I need the bin\debug\appName.vshost.exe and appName.vshost.manifest in my SVN code repository?

I am building an application which is based on a sample application,
written in C# on .NET 2, and is built on VS2008. This application is mostly a wrapper for a COM application.
However I compile it in .NET 3.5.
The sample application came with the following files in it's bin\debug:
appName.vshost.exe
appName.vshost.exe.manifest
I noticed that I can delete the files and VS re-builds vshost.exe, and the vshost.manifest file appears with modification date the same as the deleted file as if VS has copied in from somewhere.
My question is, should I put this files in my SVN code repository?
Those two files you list implement the Visual Studio "hosting process". It is a hosted version of the CLR, designed to improve the debugging experience. It takes care of some security issues, the most visible side-effect is that it redirects output written with Console.WriteLine() in a GUI app to the Output window.
These files are not part of your project and do not get deleted when you use Build + Clean. In fact, you cannot delete the .exe file, it is always running while you've got the project opened in Visual Studio. You can disable the hosting process feature with Project + Properties, Debug, scroll down, "Enable the Visual Studio Hosting process" tick. There's no compelling reason to do so.
There's no need to check these in, Visual Studio re-generates them when you check-in a project and load it in VS. In general, you never need to check anything in from the bin subdirectory, its content is always re-created by building your project.
Everything in the debug (or release) folder is generated. Everything that's generated shouldn't be checked in.
When in doubt, just make a fresh checkout to some other folder (or even machine), and try to build from that. If something is missing, this will find it.
I do not think you should. They are for VS use only.
Here are the files I ignore when creating C# projects. You really only want to store the source code in the repository and not the outputs. Similarly you probably do not want to store the user based information that goes along with VS solutions.
*.csproj.user
*.suo
bin (folder)
obj (folder)

Categories

Resources