DevOps Linking Project Dependency from another Solution - visual-studio

I'm receiving a build error in DevOps for a .Net Core 3 web application using a project dependent Razor Class Library from another solution.
For the DevOps pipeline, I receive the following build solution error:
##[error]d:\a\1\s\consumer.app.sln.metaproj(0,0): Error MSB3202: The project file "d:\a\1\s\..\framework.app\framework.rcl\framework.rcl.csproj" was not found.
I have another pipeline for the framework.app project (which also uses framework.rcl as a project dependency) but because the framework.rcl project is within that solution (and the same repo), it works flawlessly.
Is there any way (preferably without nuget) to access the framework.rcl razor class library from the consumer.app pipeline?
Everything works perfect locally as the project has been added in visual studio (via Add Existing project), but obviously that linked project is not included in source control for the consumer.app solution.
Please Help :)

I tripped over myself here. I was deep into managing project dependencies and using Azure Artifacts to do so.
However, the problem here wasn't a dependency issue. Msbuild in the Azure DevOps pipeline was simply trying to build a shared project used in the solution that wasn't available in the repo.
In Visual Studio, I simply unticked the build for the 'Release' configuration in Configuration Manager and DevOps no longer wants to build it.
I get a warning, but no error and my package reference to my Azure artifact (nuget) ensures everything wires up correctly.

Related

Azure DevOps build support for referencing separate project directly instead of via Nuget via Visual Studio

I have a project A that references project B in Visual Studio, which works locally. The folder structure of both is below:
C:\code\A
C:\code\B
But on Azure DevOps Repos, each project resides in a separate repo of a separate project, like below:
repo A in Project A
repo B in Project B
The project is the build pipeline throws exception when building project A that cannot find project B.
Is there a solution instead of using Nuget?
The downside of using nuget is that when in debug mode, we cannot step into the assembly.
Azure DevOps build support for referencing separate project directly instead of via Nuget via Visual Studio
There should be some way to do this, but the best solution is to have a single repository.
To resolve this issue, you can:
Add the .dll file of dependent project to a the NuGet package.
upload to a feed, such as Azure Devops feed: Package Management in Azure Devops and
TFS, then restore packages during the build (This is the way we are
using).
For the debugging, you could publish the symbols package to the artifact by the task Publish symbols path. Check this blog for the details.
Add Download Build Artifacts task to build definition to
download the artifact of project B build. You also can call Builds
REST API through PowerShell to get build artifacts of project B.
You can consider to use Git Submodules or Git Subtree if it is Git
repository.
If you are using TFVC repository, you can get the Extensions project
by specify additional Workspace mappings in Get Sources section of
build definition (Specify it directly, can click … to select)
Hope this helps.

project.assets.json not found - TFS Build Server, no internet

We're just in the process of transitioning from VS2013&15/TFS2013 to VS2017/TFS2017 (on-site TFS, not VSTS) and the first test solution is a dotNet Core 1.1 based one (a multi-project web service).
The solution builds fine on the original developer's box and I've got it out of TFS and it builds fine on mine too. In keeping with our previous methodology the contents of the packages folder are checked in with the projects as this makes the packages locally available on the build box (no internet).
Building the solution on the build server is a different story, however, as I get multiple errors of the form...
..\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
I get the errors both when I run the TFS build definition and when I remote to the box and build directly through the VS on the box itself.
This whole project.assets.json not found issue seems to be causing headaches all over. In my case the issue is that I'm trying to resolve it on our TFS 2017 Build Server, which does not and never will have internet access ('cos it's a server!).
All the solutions I've seen thus far seem to suggest running the Nuget Restore command but that can't work since the server cannot get to nuget.
This is nothing fancy yet, just a simple TFS 2017 Build definition with a Get sources and a Build solution step. I can't understand how something so simple has become so difficult.
Changing the Nuget Package Restore options makes no difference.
Since the project.assets.json files are generated on the fly in the obj folder, I can't even check them in to reuse. Can anyone please suggest a workaround, at the moment the test project is dead in the water.
Edit: trying the same process with a 4.6.1 web project created with VS2015 had similar results of unresolved references (e.g. System.Web) but didn't raise the same error, probably due to being an older, non-Core project.
According to I get the errors both when I run the TFS build definition and when I remote to the box and build directly through the VS on the box itself.
The issue seems not related to TFS build side since it also not work with local build through VS in the build agent machine.
Since this is a dotnet project. So, you could try to use “dotnet restore” and not “nuget restore”. Try using the dotnet core template (which uses dotnet restore).
If you are using authenticated nuget feeds, then you can use nuget restore but you also need to use nuget installer task. See https://github.com/Microsoft/vsts-tasks/issues/3762 for a discussion on that.
The Nuget version should be higher than 4.0.
Without dotnet restore and Nuget restore and only use get source/Visual Studio Build will not be able to build the dotnet core project. If your server do not have internet access, as a workaround you should use Local feeds.

Jenkins Throwing error while building .net project

I'm trying to build a .net projects on jenkins. It is throwing error saying nuget packages are missing. I'm unable to get which packages are missing exactly.
when im going inside the visual studio and trying to build the project, it is building properly without any error.
My other .net projects are building absolutely fine on jenkins. Only this project is throwing errors.
applying manual windows batch coomand to restore nuget package required by solution
adding this build step before building the solution so it will restore all the dependencies required by solution.

TFS Build server Xamarin MsBuild Exception

I have visual studio 2015 installed on the Build server with Xamarin installed. I followed the tutorial on the Xamarin web site here
I also logged into my xamarin account on the build server. I followed the xamarin creating a build definition on the web site here
But i keep getting the following exception when i kick off the build.
I'm not sure if its something wrong with the build defintion, the build machine, the android sdk, it all looks ok.
I did look into this stackoverflow answer but i've no idea where to start looking.
This is the build definition, it follows the Xamarin tutorial on the website, link above
If your local build is successful and just the TFS build is failing then it is usually due to dll reference path issue. Make sure that the Dll is referenced as a relative path in the project file (.csproj). Detail steps please refer this link Namespace could not be found - building using TFS
Also be sure that all referenced assemblies in the project can be found on the TFS build server. And double check the MSbuild version like comment suggested. You could try to add the /p:VisualStudioVersion=14.0 MSBuild argument in the build definition.

How to update assembly assembly references in a web site?

I'm making a build using FinalBuilder Pro 7.
I've an ASP.NET web site and I'm trying to use FinalBuilder's "Precompile Asp.net 2.0 Application" action. Well, It fails.
To build it successfully I need to run Visual Studio, open the web site and either build it manually from within VS or manually update all references. After that it works.
Now the question: How to force FinalBuilder to update those references? Even if I create web deployment project associated with the web site and try to build it with msbuild action it would fail for the same reason. Somehow neither action updates references automatically.
Update: OK. Maybe I need to force msbuild to update references. How to do that?
I found some properties that I can change at msbuild action.
On called ResolveAssemblyReferencesDependsOn I tried to put the value = true. Didn't help.
Any ideas?
There are different types of projects in .NET like library project, website project, web API project etc. As you mentioned in your question it is a website project, so I am going to give you a solution for website project.
You can build a project by two ways. Either you can build by visual studio or you can build by using MS Build. If you build your project by using VS, you can update references of your dependencies by executing the command "Update-Package -reinstall" in package manager console. It will reinstall all the packages automatically.
Please note that, all your dependencies are listed in packages.config file.
Secondly if you have to build your project by MS Build using cmd prompt, to load all the dependencies from nuget, you have to execute nuget.exe. By which all your dependencies will be loaded, but their references may not be updated. So in website project you do not have .proj file. So you can't have access to the references of your dependencies. Now problem is that how you can modify your dependencies references?
In website project reference of an assembly exists in its .refresh file. So you have to modify that .refresh file to update the reference of an assembly in website project.
Have you tried using the 'Build VS.NET Solution' or 'MSBuild Project' actions? Both should resolve your assembly references, provided the reference is set to the right location. This requires that you at least have a project file.
As I understand it, the Precompile action (which uses the MS aspnet_compile.exe - see http://msdn.microsoft.com/en-us/library/ms229863(VS.80).aspx) is designed to re-compile an asp.net application which has previously been built via VS or MSBuild. It does either an in-place compile to improve performance for the first user that hits the site, or creates a deployable application (removing source code etc). It's not meant as an alternative to VS/MSBuild.
I'm not 100% sure I understand the problem, but I believe you need to be able to correct some pathing on an assembly reference automatically.
I created a project to handle this (along with some other things): refswap.codeplex.com

Resources