Jenkins Throwing error while building .net project - visual-studio

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.

Related

DevOps Linking Project Dependency from another Solution

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.

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.

VS2010 Build Fail with error: Cannot open 'PathToFile.rsp'

I'm having a problem when trying to build my project and i don't know where to look.
The problem is that the build fails every time. it gives me the following error
Error messages on build
When I searched for those files I found that they weren't in that folder
The strangest thing is that if i build the same project on the visual studio, or if I run MSBuild from Visual Studio 2010 command line the project builds without problem. Also, I have configured another builder in another computer, and when I run the build there with the same Build definition it builds correctly. My guess is that it have to be some configuration that i'm missing, but I don't know where to look.
The computer is running Windows Server 2012

TFS build server error on build "The type or namespace name 'xxx' does not exist..."

I use Visual Studio 2013, and am building on TFS 2012 (update 3). I have a relatively small project that builds fine locally as well as on other machines on which I simply get the latest version from source control. When I build on the build server however I get several of the following errors:
The type or namespace name 'xxx' does not exist in the namespace 'yyy' (are you missing an assembly reference?)
Several of these errors are thrown for different namespaces, including Entity and other NuGet packages.
At first I thought that the build server was not restoring the NuGet packages, but after some investigation it seems that the packages are in fact downloaded onto the build server.
I have set up automatic package restore in VS and added the system environmental variable "EnableNuGetPackageRestore = true". To double check, I manually executed the following restore command on the server:
nuget.exe restore fullpath_to_solution\solution_name.sln
and the output was:
All Packages listed in packages.config are already installed
Then I thought that since TFS is older (2012) than VS (2013), perhaps I need to install .Net 4.5.1. But as it turned out, .Net 4.5.1 was already installed on the build server.
Any suggestions on how to get this project to build on the server?
Could be many issues, possibly proxy.
Log on to build server with build account.
Try building the solution in VS.
See if packages are restored on build.
You should then be able to trace the issue.
The best idea is to delete the contents in your workspace, then build to make sure all packages are restored properly before checking in

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