Strange error while attempting to use Zip task from .net 4.0 version of MSBuild.ExtensionPack - .net-4.0

We've been getting inconsistent results from the Zip task in Tigris MSBuild task library, so we're trying to use the Zip task in the MSBuild.ExtensionPack for .NET 4.0. But when we execute this new Zip task, we get the following error from the MSBuild executable:
C:\development\build\PrepareLastKnownGood.csproj(40,3): error : Typ
eInitializationException: The type initializer for 'java.lang.System' threw an
exception.\r
C:\development\build\PrepareLastKnownGood.csproj(40,3): error : Unsat
isfiedLinkError: Unable to load DLL 'vjsnativ': The specified module could not
be found. (Exception from HRESULT: 0x8007007E)\r
Has anyone else encountered this error in their use of the Zip task from MSBuild.ExtensionPack? If so, how did you resolve it?

Zip task from MSBuild.ExtensionPack.JSharp.dll is implemented in J#. And has dependency to the vjslib.dll.
You need to install Microsoft Visual J# Version 2.0 Redistributable Package.

Related

Microsoft.Web.LibraryManager.Configuration.Settings cannot find Newtonsoft.Json package

I have a .NET Core 2.2 project setup in Azure DevOps that uses a CI pipeline to build, and recently, after updating the Microsoft.Web.LibraryManager.Build NuGet package to version 2.1.175 the CI pipeline has been throwing the following exception every time I try and run it:
System.TypeInitializationException: The type initializer for 'Microsoft.Web.LibraryManager.Cache.WebRequestHandler' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.Web.LibraryManager.Configuration.Settings' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)
I've tried installing Newtonsoft.Json NuGet package in the project but am still getting this error.
Is there something I need to be adding to the pipeline, or something that I need added to the project itself to resolve this?

wine tells me to install .NET and mono gives error "File does not contain a valid CIL image."

i want to run hunterpie.exe . I've test wine (i've installed wine-mono) which tells me :
A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [Z:\home\osafaimal\.local\share\Steam\steamapps\common\MonsterHunterRise\HunterPie\].
If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].
The .NET runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=win7-x64&apphost_version=5.0.1
002c:err:eventlog:ReportEventW L"Description: A .NET application failed.\nApplication: HunterPie.exe\nPath: Z:\\home\\osafaimal\\.local\\share\\Steam\\steamapps\\common\\MonsterHunterRise\\HunterPie\\HunterPie.exe\nMessage: A fatal error occurred. The required library hostfxr.dll could not be found.\nIf this is a self-co"...
i've test to install .NET on my computer (Ubuntu 21.10 x86_64), Same error.
i've test to run with mono and it gives:
Cannot open assembly 'HunterPie.exe': File does not contain a valid CIL image.
Can someone explains what I should to do?

Error while Building (compile) wixproj using MSBuild api 15.9.20

I'm using wix in a project and i have a specific need :
Build wixproj using MSBuild from c#.
For that i'm using MSBuild api as folowing :
static void Main(string[] args)
{
string toolsPath = ToolLocationHelper.GetPathToBuildToolsFile("msbuild.exe", ToolLocationHelper.CurrentToolsVersion);
ProjectCollection projectCollection = new ProjectCollection();
projectCollection.AddToolset(new Toolset(ToolLocationHelper.CurrentToolsVersion, Path.GetDirectoryName(toolsPath), projectCollection, string.Empty));
Project project = projectCollection.LoadProject("TestWix.wixproj");
var result = project.Build(new ConsoleLogger());
Console.ReadKey();
}
And i get this error :
C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets(1988,5): error MSB4127: The "GenerateCompileWithObjectPath" task could not be instantiated from the assembly "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixTasks.dll". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Unable to cast object of type 'Microsoft.Tools.WindowsInstallerXml.Build.Tasks.GenerateCompileWithObjectPath' to type 'Microsoft.Build.Framework.ITask'.
But when i use msbuild command line it's work fine.
Do you have any idea please ?
Thank you in advance.

Using XAML UpgradeTemplate with TFS 2015 \ 2017

I ran into this issue upgrading from TFS 2013 to 2017. If you are still using the UpgradeTemplate.xaml to run old TFS 2005\2008 style MSBuild Team Builds (TFSBuild.proj) you will find that they do not work with the TFS 2015 or 2017 XAML build agent.
You will get this error when running the build due to some breaking changes that were introduced in the core assemblies. XAML builds have been deprecated for some time... and the old MSBuild based Team Builds are waaaayyyyy out of support. So Microsoft (rightfully) doesn't care.
But is there a way to get these builds working in TFS 2015\2017? It would be a big waste of time to convert these over to using XAML builds only to then convert them to the new build engine after upgrading to TFS 2017.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets (957): The following errors were encountered while processing the workflow tree:
'VisualBasicValue<LabelChildOption>': Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.VersionControl.Client.LabelChildOption.Fail".
'LabelChildOption' is ambiguous in the namespace 'Microsoft.TeamFoundation.VersionControl.Client'.
'VisualBasicValue<RecursionType>': Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.VersionControl.Client.RecursionType.Full".
'RecursionType' is ambiguous in the namespace 'Microsoft.TeamFoundation.VersionControl.Client'.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets (957): The "Label" task failed unexpectedly.
System.Activities.InvalidWorkflowException: The following errors were encountered while processing the workflow tree:
'VisualBasicValue<LabelChildOption>': Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.VersionControl.Client.LabelChildOption.Fail".
'LabelChildOption' is ambiguous in the namespace 'Microsoft.TeamFoundation.VersionControl.Client'.
'VisualBasicValue<RecursionType>': Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.VersionControl.Client.RecursionType.Full".
'RecursionType' is ambiguous in the namespace 'Microsoft.TeamFoundation.VersionControl.Client'.
at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.Hosting.WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.WorkflowApplication.EnsureInitialized()
at System.Activities.WorkflowApplication.RunInstance(WorkflowApplication instance)
at System.Activities.WorkflowApplication.Invoke(Activity activity, IDictionary`2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout)
at System.Activities.WorkflowInvoker.Invoke(Activity workflow, IDictionary`2 inputs, TimeSpan timeout, WorkflowInstanceExtensionManager extensions)
at Microsoft.TeamFoundation.Build.Tasks.WorkflowTask.ExecuteInternal()
at Microsoft.TeamFoundation.Build.Tasks.Task.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
You can work around this error if you don’t care about labeling your code as part of the build process or updating associated work items. In my case I was still using the UpgradeTemplate as a convenient way of performing a check-in based “Get-Latest” of source code in TFVC to the builds folder on the build machine… not really a “build” at all. So this was A-OK.
Set these two properties to true in your TFSBuild.proj
This will cause MSBuild to skip execution of the CoreLabel and the CoreGetChangesetsAndUpdateWorkItems targets. CoreLabel is the one which loads the task that is failing the build... and CoreGetChangesetsAndUpdateWorkItems needs the label to exist or it will also fail.
I found these properties by digging through the old C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets - which is the team build script that shipped with TFS 2005 \ 2008.
<SkipLabel>true</SkipLabel>
<SkipGetChangesetsAndUpdateWorkItems>true</SkipGetChangesetsAndUpdateWorkItems>

Failed to locate the code coverage command line tool , MSBuild with SonarQube

Getting the following error's once build is triggered from the build definition.
3:46:16 AM Failed to locate the code coverage command line tool Post-processing failed. Exit code: 1
Exception Message: TF270015: 'MSBuild.SonarQube.Runner.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details. (type UnexpectedExitCodeException)
Exception Stack Trace:
at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
I am using SonarQube 5.3, installed in the build server. I have .net framework installed in build server not the visual studio .
BuildDefinition where I am referencing SonarQube.
Please help me here !!!!
The code coverage tools are installed with Visual Studio not the .Net Framework, so if you want code coverage you'll need to install VS on the build agent.
Depending on the version of Visual Studio you are using, you may not need an additional license for build agent. See the discussion Is a separate Visual Studio license required for a build machine? get more detail.