What's the purpose of using solution files for DotNet Core projects? I'm using a Mac, and I can use project-to-project reference to modularize and build shared libraries without solution files:
dotnet add reference ..\Library\Library.csproj
which adds the following to my current directory's .csproj file:
<ItemGroup>
<ProjectReference Include="..\Library\Library.csproj" />
</ItemGroup>
And now building my current directory's .csproj will build Library.csproj.
Solution file works as container for application's project/projects. It comes handy when you are working on your application out of IDE. Following are some of uses of solution file.
Open project or multiple projects in IDE just by opening solution file in IDE. e.g. If you open solution file in visual studio then all of projects which are part of solution will get opened in visual studio.
You can control build/deployment of projects (what to build and what not to) under solution using solution level configuration.
If you are using editor like VS Code then solution file facilitate to build all those project which are part of solution just by running "dotnet build" command. If projects were not part of solution then you need to build them individually.
When working out of IDE (like Visual Studio) and source control you can add all project files and solution to source control just by adding solution to source control. Same goes with check in or checkout.
These are some of advantages of solution file and there can be many more. However solution file is not must have thing and you can still live without it. Its just makes developer's life easy and improves productivity.
Related
I have an ASP.NET MVC project with one solution and 52 projects in the same solution. As you know, It takes long time to build whole solution. So I decided to unload some of the projects until there is some change or sprint task in the code in the unloaded project. However we are a team and use TFS version control and we need to use update unloaded assembly. So I have a build server that makes me sure whenever somebody starts to check-in (for example -> C:\bin in our network) the last version of all assembly can be found there.
I added C:\bin path as Reference Path to the UI Project (main project of the solution) of the solution and I expect when some projects is unloaded the reference comes to visual studio from the build server path (C:\bin) otherwise the reference of the project comes to Visual Studio from the nested project (not from build server).
But the reference can not be found when the project is unloaded:
And my Build server contains the assembly:
Finally I found a way (only in Visual Studio 2019) to unload projects and however use updated class library of unloaded projects. And thanks to Hooman Bahreini for his idea of using two separated solutions.
The way is that, there is a feature of Visual Studio 2019 that we can Save As Solution Filter which is in .slnf extensions. So I can unload some of my projects and check-in .slnf file via my source control (like tfs). So I have two solutions Now, one is .sln which is contains all of projects and the other one is .slnf which is unloaded some of projects in it.
The things can we do is that whenever I want to get my project I have to use .sln file and builds that and then close the file and then open the .slnf file (I'm sure that I have updated class library of unloaded projects) and do my task and check-in my changes.
I am building a Xamarin app in Visual Studio, but am having problems with the source control, which I think is because I don't have a nuget.config file.
Firstly, do I need one per solution or one for the whole project, or alternatively just on in the PCL etc.
Secondly (the main question), is it possible auto-generate these files based on the nugets you currently have installed? Also, when these are updated, is it possible to keep the nuget.config file up to date?
Update:
In Visual Studio the Manage NuGet packages for Solution option which was present in past versions is not displayed for my project, not sure if this is the software version or the projects configuration.
How can I add a project I have developed separately to my current solution including all its project files? When I select Add existing project in my solution explorer, the project is added but I don't see the project files in my solution folder.
If you are on some version of Visual Studio, then I think that you can't do what you are asking. However you can manually copy the project to wherever you need it to be, and then add it to the former solution.
I made a project in XNA 4.0 on one computer, which has VS2010 installed with TFS, while on another I have VS2012 installed and MonoGame 3.0.1 with it. Because MonoGame is essentially a continuation of XNA, code written for XNA 4.0 should work fine with MonoGame. However, the references go to different DLL files, and build slightly different. Is there a way to sync the source (.cs) and content files, but not the project and solution files in TFS?
What you could do is manually put all .CS files under source control using Team Explorer. So... don't put the project under source control, just the source files. It's very manual and you'd obviously need to manually check files in and out.
What I use are the TFS Powertools that integrate into Windows File Explorer to make this easier.
Actually you definately SHOULD synchronise the project, just don't add the files TO the project
Project 1 (xna) with no files
Project 2 (monogame) with no files
Both checked into TFS
Then add the files to a whole other root folder and check them into TFS
Then from each project, chose add existing file, and click the the split Arrow, there is an option to add a reference to the file (instead of including the file Inside the project)
That way everything (both projects and all code) are in TFS, and the code can be shared across both projects with no issues.
I have a DLL I need to deploy with my C# application. It's not currently included in the installation package when I hit "Publish" so how do I include it?
Would the process be any different if I had app.config and other files I wanted to deploy with my application?
If it's referenced it should be included automatically. I've deployed a couple of apps that require a 3rd party dll and they've published OK.
Is the dll referenced correctly in your project? That's the only thing I can think of at the moment that might be the problem, but if it wasn't your code wouldn't compile and/or link anyway.
To get the xls file to deploy all you need to do is add the file to the solution and then set the "Copy to Output Directory" property on the file.
I take it you are using Visual Studio?
If your using Visual Studio 2008 (I have no experience with Visual Studio 2005) under the Publish tab in your project properties click on the Application Files button. This will bring up a list of all dependencies assembalies required by your project. If you find that required dll is not being published by the Visual Studio publisher tool by default you can go into here and set the Publish Status of the offending dll to Include.
Sometimes in my more complicated projects, depending on the type of dependency, I have to go into this menu and force certain dll's to be included opposed to the default Prerequsite setting.
...but this is all under the assumption you have the assembly properly referenced in the required projects and everything is compiling fine.
Can't you add the dll as a resource to your installer project?