TF215097 Custom Build Activities using Com Interop on 64 bitsTF215097: An error occurred w - tfs

TF215097: An error occurred while initializing a build for build definition {DefinitionName}: The invocation of the constructor on type 'Classname' that matches the specified binding constraints threw an exception.
OK some had already answered this very well:
TFS 2010 Custom Build Activity TF215097 error
I had the same issue before and corrected them by adding the correct attribute:
Microsoft.TeamFoundation.Build.Client.BuildActivity( Microsoft.TeamFoundation.Build.Client.HostEnvironmentOption.Agent )
My build is running well on x86 machine but give the error on 64 bit build controller or agent.
The Context :
I created several Build Activities. One of this activity is a Visual Build Pro runner activity. I referenced the Visual Build Professional 6 Server Object. (We have several project and could not update it... at this point)
When I build the assembly VS 2010 generate Native.{MyAssemblyName}.manifest
<?xml version="1.0" encoding="utf-8"?>
<assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity name="Native.EMI.TeamFoundation.Build" version="1.0.0.0" type="win32" />
<file name="VisBuildSvr.dll" asmv2:size="712904">
<hash xmlns="urn:schemas-microsoft-com:asm.v2">
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>aePKKx7BgE7vN7OjQqwrQ2bvex8=</dsig:DigestValue>
</hash>
<typelib tlbid="{c48285d5-e97e-4824-9e14-faf8124b00a4}" version="1.0" helpdir="C:\Program Files (x86)\VisBuildPro6\System\VisBuildPro.chm" resourceid="0" flags="HASDISKIMAGE" />
<comClass clsid="{d87ad38d-99d9-4e04-9505-696c3afde66c}" threadingModel="Both" tlbid="{c48285d5-e97e-4824-9e14-faf8124b00a4}" progid="VisBuildSvr6.Application" description="Visual Build Pro 6 server application component" />
<comClass clsid="{1cc058ff-793f-4560-9fad-48d88db93ca9}" threadingModel="Free" tlbid="{c48285d5-e97e-4824-9e14-faf8124b00a4}" progid="VisBuildSvr6.Builder" description="Visual Build core builder component (MTA)" />
<comClass clsid="{5ef3f30b-278b-4796-8f23-41fdd5ddc96c}" threadingModel="Both" tlbid="{c48285d5-e97e-4824-9e14-faf8124b00a4}" progid="VisBuildSvr6.BuilderSTA" description="Visual Build core builder component (MTA/STA)" />
</file>
</assembly>
And Interop.VisBuildSvr.dll assembly
When I trig a build on a Windows 64 bit Build Controller and Agent on the same machine I have the TF error.
I tried to attach the debugger on the controller and I am able to see the first error :
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'Interop.VisBuildSvr, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d64ea679b6fd0408' or one of its dependencies. The system cannot find the file specified.
That file is on my custom assemblies folder on TFS and also on the BuildController and BuildAgent folder.
Thanks

From your comment, it looks like you got it working by configuring your build to invoke the 32-bit version of MSBuild. Is that right?

Related

How do I specify a target architecture when building projects in Visual Studio code?

I am new to VS code/F# and I am trying to build a F# console app (on both Windows workstation and on my Linux computer).
I installed the Ionide extension together with FAKE.
The code I am considering is the Iris example (see How to translate the intro ML.Net demo to F#?), creating a New F# Project with Ionide and using Microsoft.ML.
My iris.fsproj is
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
<DebugType>portable</DebugType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Compile Include="iris.fs" />
<None Include="App.config" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
When running the script (which I do with the "play" button aka F#: run script provided with VS Code/Ionide) I get:
C:\Users\MyUser\.nuget\packages\microsoft.ml\0.2.0\build\Microsoft.ML.targets(16,5): error : Microsoft.ML currently supports 'x64' processor architectures. Please ensure your application is targeting 'x64'.
together with
Running build failed.
Error:
System.Exception: dotnet build failed
How do I target x64 with the project structure provided by Ionide?
It should be as simple as adding the following line to your PropertyGroup section:
<PlatformTarget>x64</PlatformTarget>
There are more complicated setups possible using the Condition attribute to set the platform target based on various command-line arguments to the compiler, but that should be the simplest way to get you up and running.

Getting an error during the deploying webapplication "Could not open Source file: Could not find a part of the path"

I got an error during the deploying my web-application.
The title of error is Could not open Source file: Could not find a part of the path
'Could not open Source file: Could not find a part of the path
'E:\ARCHIVES\Projects\Main\Jahan.Handicraft\Jahan.Handicraft.Web.Mvc.UmbracoCms.App\obj\Release\AspnetCompileMerge\TempBuildDir\App_Plugins\UmbracoForms\Data\Web.config;\App_Plugins\UmbracoForms\Data\Web.config'.'.
I've used Umbraco 7.4.3 und ASP.NET MVC in my project.
I'd like deploy it on localhost.
How can I solve this problem?
This is a failed attempt at transforming connection strings in sublevel configurations files.
To disable this transformation, edit the publish profile under Properties\PublishProfiles and set the value of the AutoParameterizationWebConfigConnectionStrings element to false. Add the element if missing.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--
...
Other settings
...
-->
<AutoParameterizationWebConfigConnectionStrings>false</AutoParameterizationWebConfigConnectionStrings>
</PropertyGroup>
</Project>
I got it from this blog (which is not mine): http://blog.aabech.no/archive/web-deploy-says-could-not-open-source-file-some-webconfig-when-you-publish-an-umbraco-site/
Post installation
You should note that the Umbraco nuget package adds a build step to always include the Umbraco folders when you deploy using Web One-Click Publish with Visual Studio.
You can see these folders in packages/UmbracoCms x.y.z/build/UmbracoCms.targets
Should you need to exclude any of these folders or content, you can add a target to your .pubxml files in the properties/Publish folder. For instance if you need to exclude json data a plugin generates during production.
<Target Name="StopUmbracoFromPublishingAppPlugins" AfterTargets="AddUmbracoFilesToOutput">
<ItemGroup>
<FilesForPackagingFromProject Remove=".\App_Plugins\UmbracoForms\Data\**\*.*"/>
</ItemGroup>
</Target>
Reference: https://our.umbraco.org/documentation/Getting-Started/Setup/Install/install-umbraco-with-nuget#post-installation

Aspnet Core Azure Failing with HTTP Error 502.5 - Process Failure

I am trying to deploy an aspnet core app to Azure. This seems to have gone through OK but when I try to start up the app I am presented with the following error...
Common causes of this issue:
The application process failed to start
The application process started but then stopped
The application process started but failed to listen on the configured port
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process’ stdout messages
Attach a debugger to the application process and inspect
There seems to be much written about IIS in this but not with Azure so I'm at a loss as to where to look next. The Azure logs are not indicating anything.
The Microsoft docs give me this info...
Platform conflicts with RID
Browser: HTTP Error 502.5 - Process Failure
Application Log: - Application Error: Faulting module: KERNELBASE.dll
Exception code: 0xe0434352 Faulting module path:
C:\WINDOWS\system32\KERNELBASE.dll - IIS AspNetCore Module: Failed to
start process with commandline '"dotnet" .\my_application.dll'
(portable app) or '"PATH\my_application.exe"' (self-contained app),
ErrorCode = '0x80004005'.
ASP.NET Core Module Log: Unhandled Exception:
System.BadImageFormatException: Could not load file or assembly
'teststandalone.dll' or one of its dependencies. An attempt was made
to load a program with an incorrect format.
Troubleshooting:
If you published a self-contained application, confirm that you didn't
set a platform in buildOptions of project.json that conflicts with the
publishing RID. For example, do not specify a platform of x86 and
publish with an RID of win81-x64 (dotnet publish -c Release -r
win81-x64). The project will publish without warning or error but fail
with the above logged exceptions on the server.
...but don't actually help by telling me what these settings should be for Azure (or if it's relevant there) so I'm not sure if this is a red herring. I'm not specifying a -r switch on my dotnet publish configuration.
I managed to find an event log which threw out some XML repeatedly logging...
Failed to start process with commandline '"%LAUNCHER_PATH%"
%LAUNCHER_ARGS%', ErrorCode = '0x80070002'.
After more investigation I discovered that I needed to change the %LAUNCHER_PATH% and %LAUNCHER_ARGS% values myself. I've tried various changes to the web.config but no luck. My web.config now looks like this...
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="dotnet" arguments="site\wwwroot\Esoterix.Modle.Portalweb.dll" stdoutLogEnabled="true" stdoutLogFile="LogFiles\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
The paths are from the root of the Azure deployment which seems to work for the stdout log file path (I was getting errors reported with that) but not for the app itself. I'm still seeing the following error..
<Event>
<System>
<Provider Name="IIS AspNetCore Module"/>
<EventID>1000</EventID>
<Level>0</Level>
<Task>0</Task>
<Keywords>Keywords</Keywords>
<TimeCreated SystemTime="2016-11-28T19:31:32Z"/>
<EventRecordID>1514022203</EventRecordID>
<Channel>Application</Channel>
<Computer>RD0004FFD7108D</Computer>
<Security/>
</System>
<EventData>
<Data>Failed to start process with commandline '"dotnet" site\wwwroot\Esoterix.Modle.Portalweb.dll', ErrorCode = '0x80004005'.</Data>
</EventData>
</Event>
Which is repeated 4 times
If I look in my stdout output I have the following...
Failed to load the dll from [\?\D:\home\site\wwwroot\hostpolicy.dll],
HRESULT: 0x800700C1
An error occurred while loading required library hostpolicy.dll from
[\?\D:\home\site\wwwroot]
If I try running the exe directly with the web config here...
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="\\?\%home%\site\wwwroot\Esoterix.Modle.Portalweb.exe" arguments="" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
Then my stdout gives me the following error...
Failed to load the dll from [\?\D:\home\site\wwwroot\hostfxr.dll],
HRESULT: 0x80070057
The library hostfxr.dll was found, but loading it from
\?\D:\home\site\wwwroot\hostfxr.dll failed
Installing .NET Core prerequisites might help resolve this problem.
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
I resolved this by adding a reference to dotnet-publish-iis.
Full details on how to do this are logged in a github issue at https://github.com/aspnet/Hosting/issues/892

Error message in Xamarin Studio: Multiple references to FSharp.Core.dll are not permitted

When I set up a new F# project in Xamarin Studio with a reference to Suave I get an error.
Here are the steps to reproduce the error message:
Create a new solution in Xamarin Studio 6. Type: Console Project in F#
Add the Suave nuget package: Suave 1.1.2
Open Program.fs and add this line on the top of the file: 'open Suave'
After this the word 'open' is decorated with red squiggles and when I move the mouse pointer over it a little pop up appears with this message:
Error: Multiple references to 'FSharp.Core.dll' are not permitted
Why does this error messages come up and how do I remove it?
What I have noticed is that the installation of the Suave nuget package had also caused the installation of the FSharp.Core nuget pakage. Here is the resulting packages.conf file:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FSharp.Core" version="3.1.2.5" targetFramework="net45" />
<package id="Suave" version="1.1.2" targetFramework="net45" />
</packages>
This happens because the Xamarin's F# project template by default references the local copy of FSharp.Core.
Removing the (duplicated) reference should fix the issue.
I just updated Xamarin Studio to ignore the local copy of FSharp.Core if the project contains a reference to a NuGet version. Should be released in XS 6.1 cycle 8.

TFS Can't Restore NuGet Package

I've got TFS doing some continuous integration builds. Today, it broke for one solution. It seems it can't find AutoMapper. All the other packages can be found just fine.
A couple relevant points:
None of the packages are in source control, we're letting TFS restore them.
We have an internal NuGet feed, but it doesn't seem to be a problem in other solutions, and in this solution we are still getting Entity Framework to restore - just not AutoMapper.
I tried removing and re-adding the NuGet Packages. No luck.
If I use Remote Desktop to connect to the build server and open the project in Visual Studio there, it restores the packages and builds fine.
I can build manually by executing D:\"Program Files"\"Microsoft Team Foundation Server 12.0"\Tools\Nuget.exe restore followed by msbuild MySolutoin.sln
Our TFS server is installed on our D:\ drive.
This is from the TFS Logs:
D:\Program Files\Microsoft Team Foundation Server 12.0\Tools\nuget.exe restore "C:\Builds\1\MyCompany Web\FclQuoteWcfService\src\FclQuoteWcfService.sln" -NonInteractive
Installing 'EntityFramework 6.1.3'.
Installing 'InternalPackage 1.0'.
Successfully installed 'InternalPackage 1.0'.
Successfully installed 'EntityFramework 6.1.3'.
Unable to find version '3.3.1' of package 'AutoMapper'.
C:\Program Files (x86)\MSBuild\12.0\bin\amd64\MSBuild.exe /nologo /noconsolelogger "C:\Builds\1\MyCompany Web\FclQuoteWcfService\src\FclQuoteWcfService.sln" /nr:False /fl /flp:"logfile=C:\Builds\1\MyCompany Web\FclQuoteWcfService\src\FclQuoteWcfService.log;encoding=Unicode;verbosity=normal" /p:SkipInvalidConfigurations=true /m /p:OutDir="C:\Builds\1\MyCompany Web\FclQuoteWcfService\bin\\" /p:VCBuildOverride="C:\Builds\1\MyCompany Web\FclQuoteWcfService\src\FclQuoteWcfService.sln.vsprops" /dl:WorkflowCentralLogger,"D:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;BuildUri=vstfs:///Build/Build/230;IgnoreDuplicateProjects=False;InformationNodeId=12;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;TFSUrl=http://ctidev2k8:8080/tfs/MyCompany;"*WorkflowForwardingLogger,"D:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;" /p:BuildId="9aa9f8af-c9b9-4d0a-ba06-7cc959231d8e,vstfs:///Build/Build/230" /p:BuildLabel="FclQuoteWcfService_20150330.2" /p:BuildTimestamp="Mon, 30 Mar 2015 20:40:07 GMT" /p:BuildSourceVersion="LFclQuoteWcfService_20150330.2#$/MyCompany Web" /p:BuildDefinition="FclQuoteWcfService"
Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException) 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've seen this too. It seems to be triggered as soon as NuGet package restore switches to the internal feed. Once it does this is doesn't switch back to the official nuget.org feed and continues to look for the packages on the internal feed.
Ensure both package sources are added to your NuGet.config file. Also ensure both sources are 'active'.
<configuration>
<packageSources>
<add key="nuget.org"
value="https://www.nuget.org/api/v2/" />
<add key="example.com"
value="http://example.com/feed/nuget/" />
</packageSources>
<activePackageSource>
<add key="All"
value="(Aggregate source)" />
</activePackageSource>
</configuration>
See NuGet configuration file documentation.
Matt's answer put me on the right track but we don't use an internal feed so I had to do some more digging. This answer works, at least, for a project created in Visual Studio 2015 and built by TFS 2015.
In Visual Studio, open the NuGet package manager settings (Tools menu > NuGet Package Manager > Package Manager Settings). Choose "Package Sources" from the options list on the left.
Create the nuget.config file at the root of the solution. This should be the same folder location as your ".sln" solution file. Copy the following into the config file:
<configuration>
<packageSources>
</packageSources>
<activePackageSource>
<add key="All"
value="(Aggregate source)" />
</activePackageSource>
</configuration>
Within the <packageSources> tag, create an <add key="" value="" /> entry for each source listed in the "Package Sources" options window. The key is the name of the source as shown above the URL, and the value is the URL itself. Include those listed in both "Available package sources" and "Machine-wide package sources". I did not create an entry for the local filesystem as it wasn't used in this solution. Based on the screenshot above, the complete config file now contains the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org"
value="https://api.nuget.org/v3/index.json" />
<add key="Microsoft and .NET"
value="https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/" />
</packageSources>
<activePackageSource>
<add key="All"
value="(Aggregate source)" />
</activePackageSource>
</configuration>
After committing the nuget.config file to source control, TFS was able to download all the necessary NuGet packages and successfully build the solution.
In addition to Matt's answer, I'd like to highlight the following well-hidden stuff from the NuGet documentation:
NuGet config files are treated in the following priority order
(closest to the folder nuget.exe runs from wins), for example assuming
the solution directory is c:\a\b\c:
c:\a\b\c\.nuget\nuget.config - This file is only used for solution
level packages, and is not supported in nuget 3.0 - 3.4
c:\a\b\c\nuget.config
c:\a\b\nuget.config
c:\a\nuget.config
c:\nuget.config
User specific config file,
%AppData%\NuGet\nuget.config.
Or the user specified file thru option
-ConfigFile.
This could explain some weird behaviour in specific scenario's where a restore does or does not pick up a configured feed, depending on whether youre restoring with nuget 2.x or 3.x
Edit: and I found yet another reason why packages might not be detected:
I have package "A" with version 1.1.1.0 .
Prior 3.4 this command works well:
nuget install A -version 1.1.1.0
With NuGet 3.4 RC I get:
An error occurred while retrieving package metadata for 'A.1.1.1' from
source 'N'. An error occurred while retrieving package metadata for
'A.1.1.1' from source 'N'. Data at the root level is invalid. Line
1, position 1.
...
The client treats 1.1, 1.1.0, 1.01.0 and 1.1.0.0 as the same version
using SemVer rules. The reason non-normalized versions were special
cased in the past is because for v2 http calls the client would first
send the version string exactly as the user specified it

Resources