Our builds are failing on the TFS build server with the same errors from time to time.
I'm getting this message on one of our projects (the error refers to a WebApi project):
The imported project "C:\Program Files
(x86)\MSBuild\12.0\bin\Microsoft.CompactFramework.CSharp.targets" was
not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
And this one on another project (on smart device projects):
The imported project "C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets"
was not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
Usually this means that the file is not there and it should be a matter of either installing the tool that contains the targets files or manually copy them from a developer machine. I've seen it before in that situation and solved it easily since it is a trivial problem.
Problem is, the files are there! The builds seem to fail randomly, which is extremely obscure to me. If we select 'Retry Build' a few times, the build goes through normally. Some times the build just works the first time, and then it starts showing this error. I failed to detect any pattern as to when it happens.
There is absolutely nothing special about the files themselves. I thought they were missing some permissions somehow, but they have the same security settings as other accompanying files.
I have no idea what to even investigate here. The message points out that a file is missing but the file is there. The fact that it occurs intermittently is even more problematic.
This is happening on a TFS 2013 build machine. Visual Studio 2013 Ultimate was installed on it after installing TFS. We have another build VM in the company using TFS2012 and I've never seen such odd behavior.
EDIT:
I forgot to mention it, but there are also a bunch of random warnings on the build containing the web project. They only appear when the error about the .targets file occurs, and do not show up on the other build. Perhaps it is related with the fact that one is .Net4.5 (the web) and the other is .Net3.5cf:
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (989): The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (989): The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (1635): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework\v4.0.30319\\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (1635): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (989): The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (1635): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework\v4.0.30319\\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (1635): There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (989): The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
EDIT 2:
Ok. After Dylan's comment, I went to the build logs to "confirm" that there was only one agent running the builds, and to my surprise:
Successful Build: Run on agent (reserved build agent Build2014 - Agent1)
Failed Build: Run on agent (reserved build agent TFS2013 - Agent1)
Build2014 is our build VM, and TFS2013 is our source control one.
When TFS 2013 was installed on TFS2013, a build agent was installed alongside it on the same machine. The controller that was installed on a separate machine also had an agent with the same name. This means that the controller was picking one of them and whenever they hit the TFS machine the build failed (because there is no dev environment there on purpose).
Removing the wrongly installed agent on the TFS machine is the way to go here.
Are you sure your builds are always running on the same build agent/server? Is it possible you have multiple build agents setup and it only works on certain ones?
Related
I create a windows .net core 3.1 application in Visual Studio 2019 on a Windows 10 machine.
The project was set to Debug Any CPU.
I installed Magick.NET-Q8-x64 version 7.2.4.0 via a nuget package.
When I compiles the application Visual Studio's output window displayed this warning:
WHY does installing this package give this warning?
Is there a different Magick.Net nuget package I need to use
warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\Owner.nuget\packages\magick.net-q8-x64\7.24.0\lib\netstandard20\Magick.NET-Q8-x64.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
1>MajickWpfAppCore -> G:\code\Mark Logic\Magick.NET-main\MajickWpfAppCore\bin\Debug\netcoreapp3.1\MajickWpfAppCore.dll
I'm trying to use F# with VS Code (v1.17.2) on MacOS (Sierra 10.12.6)
I think i've installed latest versions of Mono and .NET SDK
I'm trying just to build the simple project described here as a test
https://github.com/s952163/FSharpVSCode
after my default installation, I could do a MSBuild and run the program in the terminal without any problem. However at that stage,
(1) Intellisense is not working properly, not recognizing Deedle
(2) in the F# explorer it would say
'TestProject1.fsproj (load failed)
when doing a right-click i got this error
Error: MSBuild failed with exitCode 1 Working Directory:
'/Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1'
Exe Path: 'dotnet' Args: 'msbuild
/Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1/TestProject1.fsproj
/p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true
/p:CopyBuildOutputToOutputDirectory=false
/p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs
/p:_Inspect_FscArgs_OutFile=/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmp52c377ed.tmp.FscArgs.txt
/p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences
/p:_Inspect_GetResolvedProjectReferences_OutFile=/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmpfe4a2c2.tmp.GetResolvedProjectReferences.txt
/t:_Inspect_GetProperties
/p:_Inspect_GetProperties_OutFile=/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmpfe4a2c2.tmp.GetProperties.txt
/nologo /verbosity:quiet' Log: writing helper target file in
'/Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1/obj/TestProject1.fsproj.proj-info.targets'
/usr/local/share/dotnet/sdk/2.0.2/Microsoft.Common.CurrentVersion.targets(1122,5):
error MSB3644: The reference assemblies for framework
".NETFramework,Version=v4.6.1" were not found. To resolve this,
install the SDK or Targeting Pack for this framework version or
retarget your application to a version of the framework for which you
have the SDK or Targeting Pack installed. Note that assemblies will be
resolved from the Global Assembly Cache (GAC) and will be used in
place of reference assemblies. Therefore your assembly may not be
correctly targeted for the framework you intend.
[/Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1/TestProject1.fsproj]
to try to solve this, i typed in the following
export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/
but worse, after that, the project doesn't build anymore in VS Code as I get this output when trying (Cmd-Shift-P) MSBuild: Build Project
/usr/local/share/dotnet/sdk/2.0.2/Microsoft.Common.CurrentVersion.targets(1122,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/Users/francois-guillaume.rideau/Documents/FsharpVsCode/TestProject1/TestProject1.fsproj]
screenshot here https://imgur.com/KtMM2Bu
VS Code environment is passed to msbuild when it invokes it, so setting environment variables on startup of VS Code does the trick:
FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/ code .
Go to project location in the terminal and then run FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/ code . as said before.
Then you should be able to build again.
I am upgrading our TFS 2012 system to TFS 2015, and have an issue with one of our upgraded XAML builds. The build compiles >200 projects without an issue, however two project produce the following SGEN error. It appears the build engine attempts to build the project using the x86 4.0 version of the mscorlib, but I think it needs the x64 version. The build server has both x86 and x64 versions of the .Net 4. 0 framework installed.
From the build Log:
Built $ Change-Management/.../Helpers.csproj for default targets.
WARN: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets
(1605): There was a mismatch between the processor architecture of
the project being built "AMD64" and the processor architecture of the
reference
Warn: "C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll", "x86".
This mismatch may cause runtime failures. Please consider changing
the targeted processor architecture of your project through the
Configuration Manager so as to align the processor architectures
between your project and references, or take a dependency on
references with a processor architecture that matches the targeted
processor architecture of your project.
WARN: CSC:Assembly generation -- Referenced assembly 'mscorlib.dll' targets a different processor
ERROR: SGEN: An attempt was made to load an assembly with an incorrect format:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll
I have tried the SO solution described here but it did not work. I attempted to install the Widows 8 SDK (the server is 2008 r2).
Ideas?
You may try to go to the Build|Configuration Manager menu item, and change the platform for your project from "Any CPU" to "x86" to see whether the error persists:
Find the project in Build|Configuration Manager.
Select the in the platform drop down.
Select x86 from the "New Platform" drop down and select "Any CPU" in
the "Copy settings from" drop down.
Click OK.
A TFS 2012 build server with .NET 4.6 installed produces the error message below when trying to build a website targetting .NET 4.6.
The machine has been restarted since the install.
Do I need to somehow tell TFS to favor .NET 4.6?
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets
(983): The reference assemblies for framework
".NETFramework,Version=v4.6" were not found. To resolve this, install
the SDK or Targeting Pack for this framework version or retarget your
application to a version of the framework for which you have the SDK
or Targeting Pack installed. Note that assemblies will be resolved
from the Global Assembly Cache (GAC) and will be used in place of
reference assemblies. Therefore your assembly may not be correctly
targeted for the framework you intend.
I installed the .NET Framework 4.6 Targeting Pack on the build server and that resolved it for me.
Firstly, you need to be sure that all referenced assemblies in the project can be found on the TFS build server. For best practice, you need to install VS2015 on the build server machine.
Secondly, you need to customize your TFS build process template to explicitly set the ToolPath variable in the Run MSBuild for Project activity to be C:\Program Files (x86)\MSBuild\14.0\Bin. Or add /tv:14.0 argument to MSBuild command.
I have a .Net project (framework 4.0) that references PostSharp assembly (version 2.1). The project is configured for Debug and Release with Any CPU.
I'm trying to build that project on TFS (2012), created a build definition where I add two workspaces:
- One workspace with the directory where is the PostSharp.dll assembly
- One workspace where the .csproj file is.
The configuration I added is Debug | Any CPU.
When I attempt to build, it states that everything works fine but warns that my project doesn't have an OutputPath configured. After googling, I found out that it was related with the Any CPU, that should be AnyCPU without the space.
But if I do this, when TFS attempts to build my project it states that The type or namespace name "PostSharp" could not be found.
So if I use Any CPU TFS seems to recognize PostSharp, but if I use AnyCPU seems to recognize my project but not PostSharp.
Is there any workaround for this?
Thank you.
In the meantime I found the answer, it was the Build agent folder for my PostSharp assembly directory that was wrong. Works fine now.