Azure DevOps project build returning with log4net error - build

I'm trying to build a visual studio 2015 dot-net application which has log4net reference in the code.
When I build in Azure DevOps using Nuget restore, Nuget Tool installer, Visual studio build, Publish Build artifacts I am getting an error:
Error CS0246: The type or namespace name 'log4net' could not be found (are you missing a using directive or an assembly reference?) Process 'msbuild.exe' exited with code '1'.
Please someone suggest whether I have to add another agent or make some reference to the package/nuget in Azure DevOps. need details since I'm new to Azure DevOps.

The error message suggests that either the using is missing or the assembly could not be found, meaning that probably the nuget restoration has failed.
If you can't figure out the issue by looking at the log, the first step should be to set system.debug to true, then you might get more info about what the issue might be.
My first instinct when I don't know what's going on would alsways be to look into the s folder of an agent but I don't have experience with hosted agents and as far as I know you cannot access the working folder of a hosted agent.
So as a workaround (only if everything else fails) I would suggest to zip the s folder ("$(Build.Sources)") or special parts of it into the a folder ("$(Build.Artefacts)") and publish that zip as an artefact. Then you can download it and look at it in great detail, e.g. look at the packages folder or open the solution and see why it doesn't compile.

Problem was partly solved as there was .gitignore and .gitattribute files in my source directory which i guess had entries to ignore the third party .dlls like log4net and several folders which were not getting checked-in when i did vsts push. But there arose some other errors in vsts build now which i am trying to figure out. I will create a new thread for that.
Thanks.

For some reason I lost ability to see it in
Tools -> Manage Nuget Packages for Solution
However from the docs
I used
Install-Package log4net
in Package Manager Console
That solved the issue.
Previously I had noticed the yellow triangle against log4net In Manage Packages For Solution, and may have tried removing it via Nuget.
However it was still showing as a reference

Related

Is ArtifactStagingDirectory always empty with each build in DevOps pipeline

We are using Build Pipeline in Azure DevOps to create a Deployment Artifact. Typical steps in such pipeline are:
Build Solution / Project
Copy dlls output into $Build.ArtifactStagingDirectory
Publish Artifact from $Build.ArtifactStagingDirectory
I just wonder if I can rely on the fact, that on start of each Build the Build.ArtifactStagingDirectory is empty. Or should I clean the folder as first step to be sure?
From my experience the folder was always empty, but I am not sure if I can rely on that. Is that something specific to Azure hosted Agent and maybe by using custom Build agents I have to do manual clean-ups of this folder? Maybe some old files from last build could remain there? I did not found this info in documentation.
Thanks.
I think that the main idea of this variable $Build.ArtifactStagingDirectory is to be a clean area so you can manage the code you're pushing from your repo. As far as I know, there is no explicit information on documentation talking that this folder is empty at every new build, but there are a few "clues":
You can see at the Microsoft's Build Variables documentation that Build.StagingDirectory is always purged before each new build, so you have a fresh start every build.
In the documentation above you have a few cases where it explicitly cites that some folders or files are not cleaned on a new build, like the Build.BinariesDirectory variable.
I've run a few build and realeases pointing to my Web App on Azure, and I never saw an unwanted file or folder that was not related to my build pipeline.
I hope that helps.

How do I create a TFS2017 Build Task equivalent to Visual Studio's Web Deploy Publish method?

I am trying to complete Continuous Integration/Continuous Deployment automation for a web application project. I have been helped by a series of SO posts link1, link2, link3 and things are now running, except the upload to the hosting server is longer than it needs to be; I currently upload all files instead of just the ones that changed.
When creating the TFS2017 Build (or Release) there are many Task options, including some from the marketplace. I'm referring to, in this case, the dialogue for a Build as shown below:
I'm currently using a PowerShell script which seems a little archaic and inefficient as noted above. Do any of the tasks available to us mimic the Visual Studio 2017 Web Deploy Publish Method which runs quite nicely and quickly? If not, what can I use for an 'intelligent' upload process that checks whether or not a file must be uploaded?
Unfortunately, there is no this kind of build task could mimic the Visual Studio 2017 Web Deploy Publish Method for now.
The method trough VS IDE will dynamically check if some files need to be uploaded or not.
However through TFS build task or powershell script will not do this, just simply copy all files you assigned. Afraid there is no workaround for an 'intelligent' upload process that checks whether or not a file must be uploaded. Since we don't how VS IDE did this.

VS2017 not showing Report Viewer in prerequisites

I am trying to deploy a wpf application with an embedded rdlc report using clickonce. The previous version of report viewer (in VS2015) was built-in so it was easy and convenient to use and I had no issues deploying this project.
Now since easy and convenient is not the goal anymore, in vs2017 after a failed deploy with an error message that gave me absolutely no help, I have come to realize that apparently you have to install 2 additional VS extensions and a report viewer runtime on every machine where an app uses and rdlc reports (feels like crystal reports all over again) and you have to exclude the automatically included Chinese localization files in your clickonce deployment (which cause a manifest parse error). Anyway, the instructions on MS website say that click once should have a "Microsoft Visual Studio Report Viewer" prerequisite option to select as requirement of installing your app. However, after installing the runtime on my development machine, restarting visual studio, this option is not available. Does anyone know how to get this to work?
I used Project|Manage NuGet Packages to add this package to my project.
https://www.nuget.org/packages/Microsoft.ReportViewer.Runtime.Common/12.0.2402.15
If you search with Manage NuGet Packages, there's quite a few ReportViewer related items. I'm not sure which ones are appropriate to your WPF app.
Anyway, the deployment project picked up the various ReportViewer assembly dependencies and everything seems to be working without the EXE redist from MS.

OpsHub v2.0.0.004 Template Mismatch on standard Scrum Process template

I've found a couple of similar questions on Stackoverflow, but the answers do not solve my issue. (For example the issue would be fixed in previous version. OpsHub TFS 2010 to Visual Studio Online)
Also I experience different behaviors on multiple environments so I think it's a new question. I hope someone can help me.
I have some projects on a TFS 2012 with the standard Scrum 2.2 template. I created a Visual Studio Team Services environment on my personal account for testing the migration. I created a project based on the default Scum process with the same name as the project in TFS. When I use the OpsHub tool (version 2.0.0.004) to migrate the work items to VSTS it works as expected.
screenshot of working migration
Now I create a new project on my companies VSTS environment with the same name and the same Scrum template. Apply the same rights, and try to migrate the same project to companies VSTS, validation fails with the message that "template customization or template mismatch". Details "Code Review Response - Reviewed By"
screenshot of failed validation
I exported the scrum process templates for both environments and compared the contents but they are identical.
So I have 1 project on TFS and 2 projects on VSTS with identical templates. One migration works, the other does not. I'm stuck. Any tips would be very welcome!
Thanx
I got an email from OpsHub with the solution! They released a new version (2.0.0.005) and after clearing the cache, it works! Thank you, OpsHub.
Refer this to download the latest version.
Perform following steps:
Close the OVSMU Tool if running.
Installed the latest version OVSMU-V2.0.0.005
Clear the following cache folder:
Close the OVSMU Tool as well as any instances of Visual Studio (ie. TFS related applications)
Clear the contents of the following folders (whichever ones you have)
%localappdata%/Microsoft/TeamFoundation/3.0/Cache
%localappdata%/Microsoft/TeamFoundation/4.0/Cache
%localappdata%/Microsoft/TeamFoundation/5.0/Cache
%localappdata%/Microsoft/TeamFoundation/6.0/Cache
Launch the newly installed OVSMU Tool & Configure the migration again.

VC++ application doesn't run on other machines due to "incorrect configuration error"

I know that this topic has been posted over a dozen times, but I wasn't able to find a topic that fit my issue so I will post all detail below.
To start I will mention that I have two projects: The first is the main application and the second is a DLL. The project was due for a major revision and needed a DLL to be replaced due to the company I work in switching vendors. After creating the DLL needed to import into the project I was successfully able to test and run on my machine as well as other developers machines. However once I tried to deploy it on our barebones testing machine I got the error stating that the application configuration is incorrect.
Seeing as I've seen this error before I tried to install the vcredist but I got the same error message. I tried using dependecywalker to see if I had all my needed files for the application to run to which it stated that I was missing MSVCP80.DLL, MSVCR80.DLL, and MSVCR90.DLL. Seeing as running the vcredist didn't help I tried to create a msi installer. Once I deployed that I got the application to run, but at the same time it didn't. The application needs to load in configuration files to be able to run properly otherwise it is not able to connect to our database.
I was wondering if anyone had any advice on how I can include the needed policies/dependencies in order to get this project to be able to run successfully.
To sum it up:
Release application is able to run on other developer machines and
able to load all proper configuration files, but cannot be run on any
bare bone or test machines.
Application created from Visual Studio Installer is able to run, but
ignores the configuration file directory and tries to load in default
directories.
Project is built using VS2005 C++.
Any help would be greatly appreciated.
Thanks,
Sebastian
There are different versions of redist regarding the VS service pack. So make sure, that if you have installed the VS2005 with service pack 1 you provide the redist for VS2005 service pack 1.
You might have gotten the ATL security update on your build machine but not the target.