Visual Studio Online Include Custom Assemblies - c#

Here's the scenario:
In Visual Studio Online
Single Project Collection - DefaultCollection
5 Different Solutions
1 Solution has a dependency on the other 4
Trying to use build process template TfvcContinuousDeploymentTemplate.12.xaml in order to perform an automatic deployment from VSO to Azure Web Application
Needing the first 4 solutions to build so that the 5th solution will build, however, it cannot find the dependencies no matter what I try.
Here's what I've attempted thus far...
First Attempt
Added the 4 additional source control paths to the "Source Settings"
Added the 4 additional solutions (in order) to the Process -> Build - Projects
This is the ONLY way the solution will build, HOWEVER, Continuous Deployment is skipped due to multiple solutions being built.
Second Attempt
Compiled the first 4 and copied them to the Drop folder
Set the additional source control path to the Drop folder
5th Solution build fails because it cannot find references
Third Attempt
Compiled the first 4 and copied them to the Drop folder
Set the include folder on the build controller to the Drop folder
5th Solution build fails because it cannot find references
Fourth Attempt
Compiled the first 4 and copied them to the Drop folder
Downloaded the contents of the Drop folder and checked the contents into a subdirectory of the BuildProcessTemplates folder in the 5th project.
Set the include folder on the build controller to the checked-in folder
5th Solution build fails because it cannot find references
Any thoughts? I'm at a loss.

Any solution that you take a dependant on should publish it's output as a Nuget package to a local repository. Your other solutions can then take a dependency on that package.
You can then control the version of the dependency.

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.

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.

ClickOnce: Publish a child project together with main project

I have a VS Project containing 2 projects. One is the main Project called "main" which is an executable. The second project called "main-ext" is also an executable, but it is an extension to the first one. It has "main" as a reference because it uses some of main's types.
I'd now like to make a ClickOnce publish of "main" that also includes "main-ext". I have already successfully set up ClickOnce for "main". But I cannot include the output generated from "main-ext" in that publish.
I then found out that you somehow need to include the files from "main-ext" into the project of "main" in order for ClickOnce to deploy them.
Now, with that in mind I have tried the following:
Add "main-ext" as reference to "main". This obviously does not work because of circular references.
Add the output EXE of "main-ext" manually as "Content" with "Copy Always" to the project "main". While this does work, it has a huge problem. If I should ever delete the output files (or run Build > Clean), I can't get the solution to build anymore. Because "main-ext" needs "main" to build, and "main" needs the output of "main-ext" to build. Same circular references, just a little different.
Any ideas?
The next step I'd try would be to refactor "main" and move all the common types and things, that "main" and "main-ext" share, into a dedicated third project, a class library. But because the project is rather large and complicated, I'd like to leave that as an option of last resort.
Thanks.
Look into modifying the ClickOnce's manifest. The idea is:
Main doesn't reference the ext
build ClickOnce for main
publish ClickOnce
open .application in ManifestManagerUtility (alternatively you can do that using ClickOnce API, I think)
add reference to your main-ext
re-sign the manifest.
Then you can allow your users to download a new version. Both files should be installed on client's machines.
Have a look at this chapter in Prism documentation, it contains a step by step description of a very similar scenario.

Include Reference in project file structure

Sorry, a bit of a noobish question here...spent an hour on Google and in MSs help documents, my head appears to be in the wrong place, I can't figure this out.
I have a C# project set up in Visual Studio 2012 that has references to a few .dlls that I have on my own hard drive (NetOffice .dlls to be specific, for Excel Interop). I've been adding them by right clicking on my references folder, going to Add Reference and then going to Browse to find the files. At that point they are included and everything works as expected on my side.
The problem occurs when I share the project. I'm using Git to keep the project coordinated between myself and a couple team members. I'll run my commit and push it then have my teammate do his pull. Everything shows up on his computer correctly, but when we open up the project it tells me that the NetOffice .dlls are missing.
I'm guess that this is because the files are only linked locally on my computer, but I can't figure out, for the life of me, how to make the .dlls exist in the file structure so that they travel with the project when I push it.
We have a few NuGet packages we use as well, and they seem to work just fine after being transferred. I've also gone into the .dll properties for NetOffice and turned "Copy Local" to true, yet it's still not included.
All I want is to be able to link references and then send the whole thing (dlls included) to my teammate, what am I doing wrong? I figured I would want to simply include the .dlls in the project structure but... I'm just not understanding something. Any help please?
1 Create a folder in the file system at the same level as the solution file.
2 Copy the external dll's to that folder.
3 Add a Solution Folder tho the solution.
4 Add each dll to the the solution folder using add existing item
5 Reference the Dll's in the solution
The steps 3 and 4 aren't really necessary, but they help to keep things organized.
Lets assume your source control root folder is called SourceRoot
and your solution files are under a folder called JaySolutionFolder
I prefer:
Adding a new folder to your source control, under SourceRoot, called SharedDlls
Copy all external Dlls to this Folder.
Add this dll references form SharedDlls to your project.
Commit this folder
Now your teammates have to get JaySolutionFolder & SharedDlls to compile the sources.
Later this SharedDlls could be target directory of Build process (Using tools like TFS Bulid, NANT or else)
This will be a way to minimize team based development problems.
In release and software installation, you can use installers or software package builders like installshield or Visual Studio Setup Package or ... to solve external dlls problem
Hop this helps.
Although it's not good practise to include binaries in your git repository, doing so will solve your problem.
The quick fix could be to create lib directories in sensible locations within your repository (I'm not a C# developer but Gama Felix's suggestion seems correct).
Then commit these folders and push to the server.

Visual studio linked files with TFS - automated build does not work

I have two Visual Studio solutions, one for WebApi and one for WP7 development, I am linking some dto files from WP7 solution to WebApi solution, this works great.
I just added the solutions to Team Foundation Service preview, and tried to get it to build. Since the linked files doesnt get added to source control, I cant build the project, because it cant find the linked files.
I tried adding the WP7 solution to the same directory in TFS, but no luck.
Edit- More information:
I get: CSC: Source file '....\TennisTracker.Client.Ui\TennisTracker.Client.Core\Models\GameDto.cs' could not be found
Then I add the client solution under "Edit build definition - Process - 1. Required - Items to build. I get this: C:\a\src\TennisTracker.Client\TennisTracker.Client.Ui\TennisTracker.Client.Ui.csproj (140): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Silverlight for Phone\v4.0\Microsoft.Silverlight.WindowsPhone71.Overrides.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
In the error console, in visual studio, it gives me this error: Error: API restriction: The assembly 'file:///C:\Users\markka\AppData\Local\Temp\VSTFSBuild\ae65cc1a-850e-4112-8c34-96674d8c79f3\2052550994\nunit.core.interfaces.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
The workspace is set to the entire directory, containing both solutions
Under the build definition you can define the workspaces which you can point / setup paths to the other project.
Best thing to do is post up the build error output and I can then hopefully let you know the exact path you need to setup

Categories