msbuild projects build order - msbuild

I am building a solution in visual studio 2005, it is working fine but when I build it from msbuild some files do not get copied in start up projects bin folder. Please tell me how to solve this problem.

You should add a reference to the projects which are required but not copied to bin folder. VS is more lenient about references then MSBuild is. If you have 3 projects A, B and C. A references B and B references C then you should add a reference to both B and C in project A.

Related

Nested references between database projects in SSDT cannot be resolved

I'm currently creating a huge database solution with over 40 projects and tons of references.
It's a very common situation that project A references project B, then project B references project C and so on like this:
A->B->C->D
When I'm trying to build project D it's all working correctly. Same for project C, it resolves reference to D and builds successfully.
When I try to build project B I get an error like this:
The reference to external elements from the source named D.dacpac' could not be resolved, because no such source is loaded.
I'm sure that all references are set up and nothing is missing. My dacpacs are stored for each project in bin/Debug folder.
Please help me with some hints or ideas on how to continue my investigation.
Even do I've answered in the comments already, it might be helpful for other with similar problem.
The solution is: you need to add reference to parent project of all other dacpacs. So in your case project B should have reference for both C and D projects.
Another possible option would be to tick the "Reference to external elements problem with nested database references" checkbox when you add reference to C project, but that's not always work.

Build Multiple Projects in a Single Solution for VSTS

I'm in this case, I have a single solution built on Visual Studio 2013. It contains more than 10 projects that reference each others, I need only to build and release 3 projects of them on Azure via Visual Studio Team Services so the question is what is the best approach to do this
Thank you
If they all reference each other than you may need to build all of them. Dependencies will be resolved at build time.
You can reference individual Project files in place of a Solution. You will then need to maintain order yourself.
Just use the same build step for building a Solution, but fill out a Project (.proj) file instead. Control the order by having multiple build steps.
Please read my Suggestions below-
- Copy all the references dll's in one shared folder through Post build event.
- Create new solution according to your deployment needs and take all references from the shared folder in all projects.
- Deploy the solution you want
If the references are project references, you just need to specify the solution file (.sln) to build, otherwise, you need to specify project dependence (Right click your solution=> Project Dependence=>Select a project=>Check the projects’ options that dependence to)

In Visual Studio 2013, is there a way to access classes in a DLL that is referenced within an included project DLL?

For Example, if I include a reference to Test1.DLL in my project and Test1.DLL references Test2.DLL is there a way I can access logic within Test2.DLL in my project without adding a reference to it directly in my project?
Yes u can do. Your project contains Test1.dll.
Ex: Your Project
reference->Test1.dll
Test1.dll refers to Test2.dll,Test3.dll,...
If any changes in Test2.dll,Test3.dll it will reflects the Your project. When ever Your building the project.
Regards,
Sekhar

Assembly in GAC is not copied to output in project that references a project that references the GAC assembly with CopyLocal=true

I have a "Project A" that references System.Web.Mvc with CopyLocal=TRue.
System.Web.Mvc is in the GAC both on my local maching and on the buildserver.
I also have a "Project B" that references "Project A" in the output for "Project B" System.Web.Mvc is not copied to during the build.
I suspect that this is because it is in the GAC.
Is this true?
And can I do something to make MSBuild copy it to the output folder?
I read the answer from Muse VsExtensions in this thread, which talks about only the direct reference to the GAC, however we have an indirect reference through "Project A":
.NET Reference "Copy Local" True / False Being Set Based on Contents of GAC
This blogpost is also related:
http://deeperdesign.wordpress.com/2010/02/08/msbuild-assembly-dependencies-and-the-gac/
Did you check the .csproj file to verify that the reference does indeed contain the <Private>True</Private> tag? Copy local is unfortunately has 3 states in the xml - True, False and ... missing.
A pragmatic (read hack) solution is that I referenced System.Web.Mvc.dll in "Project B".
This is definitively not the right solution, so please bring me a better solution :-)
One suggestion I've seen floating around for this one is to change all of your projects to have the same output path. This is of limited value though, since if you have a dependency chain like:
Prj B > Prj A > Lib C
Then it's probably because Prj A is shared across multiple applications, for which you will want to each have their own output path.
I resolved the issue by instead using MSBuild to compile, and setting the OutDir property on each build.
e.g. MSBuild projectB.csproj /p:OutDir=C:\AppBOutput\
This will put the output for project B, its dependent projects (prj A), and prj As copy local dependencies all into the C:\AppBOutput\ directory.
Why it Works
When building the project in Visual Studio, both prj A and prj B have their own output directory, e.g. prjA\bin\debug and prjB\bin\debug. The GAC-stored assembly set to copylocal will be included in the output directory of the project that directly references it (prjA). But it will not be copied to the output directory of the project referencing that project (prjB). That's just how the project reference copying works. Dig into the MSBuild targets and I'm sure the underlying reason could be found (sorry, not doing it myself).
What the /p:OutDir=C:\AppBOutput\ MSBuild parameter does, is set the output directory of all projects to be the same. By doing this, you side-step the MSBuild behaviour of how it copies project-to-project reference outputs. Instead of relying on MSBuild to copy some of the content in prjA\bin\debug to prjB\bin\debug, you just force all projects to output to the same directory.

Compiling and deploying assemblies that are used as references for other projects

Okay so here is my situation:
Project A is in solution A, lets call it's output a.dll.
Project B is in solution B, lets call it's output b.exe.
Project B references a.dll
Both solutions are under source code control in different repositories.
My question is: how can i assure that Project A's output gets redirected to project B's "External references" folder, overriding the previous version of a.dll, regardless of what the local developers path structure looks like, is there a way to do this? alternatively could solution A, invoke the build of solution B and then copy it's output locally?
To be brief, automating builds accross solutions without a 'common directory structure' is possible through the use of:
commandline parameters
environment variables
I would encourage you however to consider the "Convention over Configuration" mantra and think up a convention about the relative positions of solutions A and B.
Furthermore it's possible to build projects and solutions using the MSBuild task. The binaries can be copied to your "External references" folder using the Copy task.