.Net folder compilation tool - c#

I have a folder with many .csproj files. I have many folders like this.
I have a big solution with all my projects in it, but most of the time i just want to compile all the projects in one of the folders.
Is there a tool that I can use to let's say right click on the folder-->"Compile all"?

Did You try Building the Solution that contains all the projects?

Either:
Select all of the projects in the solution explorer that you want to build, right click and select "Build Selection"
or
Add a/several build configuration(s) that only builds the projects that you are interested in
or
Create a new solution file with the projects that are grouped, which will only build those (the solution file can exist in the same location as the current one)

Related

VS intellisense not working on solution with multiple projects

I am working on a .NET Core/C# solution that contains multiple projects. I have done so before but for this one I set up everything through a remote server in a linux terminal. Once all my projects were created and pushed to GitHub, I pulled to my local machine. Problem I am running into is that intellisense is not working at all in any project in my solution. I am wondering if I set up everything correctly or if there is something I am missing. Below is some screenshots of my directory and one screenshot of VS.
root dir from repo
1 dir down into BlabberApp folder
2nd dir down into BlabberApp.DomainTest
What is shown in VS when I open root dir
What is shown in VS when I open solution file
I have tried opening using open file for: .csproj file, .cs file, as well as open folder for various folders that hold my separate projects. I also tried to open folder to the BlabberApp folder which contains the folders that hold my .sln as well as the folders that hold all my separate projects. I need intellisense to recognize references some projects have with each other. I also need it to recognize my tests to properly test everything. One thing peculiar I found is when I open the .sln file it shows in the solution explorer that 0 projects are loaded. Also none of my tests are recognized in the test explorer (I have tried cleaning and building the sln with no changes showing in test explorer).
I have also gone through the steps of going to tools -> options -> text editor -> c# -> intellisense to check/uncheck the boxes under completion lists. Any advice would be helpful! Thanks
It seems any of your projects are not listed in your solution. Somehow they unloaded from the solution. You can add the projects one by one in the solution. Or you can take help of a plugin that will add all projects from the solution folder at once. please add them by the following step:
Add this VS extension
Right-click on the solution and click on Add multiple projects
check Add solution folder
Click Load Projects From Folder
Select the solution directory
Select all projects
Click start
please follow the link instructions for more details.

Taking sln file from other app

I worked on some C# app (wpf), I uploaded it as zip file to google drive for now that's the only copy of the project That I have.
The problem is that I forgot to upload the .sln file.
When I downloaded the app from google drive to my pc I took some other .sln from other app and it worked fine for now.
Is it ok? I mean it can cause any problems in the feature?
A solution is sort of like a container that holds all your projects together. So as long as you have a valid project file (.csproj) you can simply create your own solution file and add the project to it.
If you go to:
File > New > Project
you can open up New Project dialog box.
There, under:
Installed > Other Project Types > Visual Studio Solutions
you can create a blank solution.
Once you do that, then you can add your existing project to this new empty solution.
For that, go to your Solution Explorer, right click the solution and select Add > Existing Project and select your project.
I took some other .sln from another app and it worked fine for now:
Most of the time: If you have a single csproj file, all you have to do is double click on the csproj file to build it. Visual Studio will automatically create a solution for your single csproj.
Is it ok? I mean it can cause any problems in the feature?
I think the big issues will only come when you have more than one project in your solution.
For example, lets say you have a solution with Project A and Project B, and project B has a reference to A.
You will need to add both projects to your new solution so that .NET knows to build A first, then build B using the output from building A.

Open a csproj and not the entire solution

I am working on a solution that contains 30 cs projects. I am focusing on only 1 project so I preferred to open only this specific project.
Once opening this specific project, it loads the entire solution wiht all the others 29 projects.
Is there a way to open only this specific csproj?
The following structure can be used to get the desired behaviour:
Create a new Visual Studio solution
Delete the created default project
Add an existing project to the solution
Set the project as startup project (for re-build etc...)
You are now ready to go
You can do this in minutes and it's quite simple. Each sln file contains a number of projects that are written in this form :
Project(...) = "name.of.the.project", "{unique identifier of the project}"
and below that are the configurations for that project.
So you can write a javascript file to copy your original sln into each project folder found in that sln. After that iterate through each project folder and for each sln remove other projects. The javascript file can be runned using a .bat or cmd.
In this way you can assure that each project of your solution has inside his folder a new solution that contains that project.
We have a solution at work which has hundreds of projects.
So what we have done is have a Main.sln which contains everything. Then were have broken up the rest of the projects into different smaller solutions where they are grouped by relevance.
ie. All the database projects are in one solution, UI projects in another etc.

Analyze VS2010 C# projects and report files on disk not part of the projects?

I discovered earlier tonight that files and folders I have removed from my C# projects are apparently still on disk, even though my Visual Studio Mercurial plugin seems to do a good job of deleting them when I delete them in Visual Studio. It must have hickuped when it came to these files.
So I wondered... Does anyone have a script or similar, or know of something, that will look at my .csproj files and report extra files and folders on my disk that isn't part of the project files?
I just want to clean up my repository contents.
Easiest way is to go to the Project menu and choose "Show All Files".
This option is set on a per-project basis.
If you enable the "Show All Files" option in the solution explorer, any files not included in the project file will be shown with white icons.
alt text http://img686.imageshack.us/img686/9986/85818429.png
If you then fully expand the project tree, you should be able to see any file that is not included in the project. Additionally, you will also be able to see any files that are included in the project but are not present on disk (these will have a warning triangle overlaid onto them).
This is a per-project setting, so you will have to do it for each of your projects.

ClickOnce & References

I have created a ClickOnce Solution with VS2008.
My main project references another project who references COM dll as "links".
When I build my solution in VS the dlls from the orther projects are moved in my bin folder but when I publish and launch the project these files are not presents in my Local Settings\Apps\2.0... folder.
I know that I can add each dll of the other project as a reference of my main project but I'd like a cleaner solution ...
Is it possible ?
First add those files to your project directly.
Then goto Application properties -> Publish -> Application files
Select "show all files" if you do not see the files you need and then set their
publish status to "Include" NOT "Include (Auto)". This is important or they will not be added.
Please note if you update the files, you will have to remove them and add them again
and set their publish Status again. This is a small bug.
See a previous question of mine for more info:
ClickOnce - Overwriting content files
You need to open the "Application Files" dialog in the Publish tab of your project. From there you can set the publish type (Include, Prerequisite, etc.) of each of your files.
If it's an unmanaged DLL, you'll need to add the actual .dll as a file to your project and mark its build action as "Data". You can then set the Publish Type of that file to Include.
I had the same issue.... and the only way to fix this after going through many options, was by adding those dlls to References.
It works, but I hope there would be a cleaner solution to it in future.

Categories