Getting dnu build working on TeamCity - teamcity

We're trying to get a vNext project building on TeamCity 9.16 - the project is using the dnx451 and dnxcore50 frameworks.
When TeamCity is running dnu build for DNX,Version=v4.5.1 it's erroring when trying to build System.Configuration 4.0.0 with the following error:
DNX,Version=v4.5.1 error CS0012: The type 'Action<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes
However running dnu build from the command line when logged on to the machine as the TeamCity build agent is successful (after running dnvm upgrade)
I suspect that this might be something to do with TeamCity and Paths but am at a loss as how to proceed.

Related

dotnet publish, Core project with framework references, fails with release configuration

Publishing in release configuration gives this error:
Microsoft.Bcl.Build.targets(97,5): error MSB4062: The
"EnsureBindingRedirects" task could not be loaded from the assembly
...\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.Tasks.dll.
Could not load file or assembly 'Microsoft.Build.Utilities.v4.0,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
The system cannot find the file specified. Confirm that the
<UsingTask> declaration is correct, that the assembly and all its
dependencies are available, and that the task contains a public class
that implements Microsoft.Build.Framework.ITask
This is my publish command:
dotnet publish .\MyProject.csproj --runtime win10-x64
--self-contained --configuration release
If I omit the configuration parameter the build is successful.
Building with Visual Studio (msbuld) works with debug or release configurations.
This is a .Net 5 project that references projects that use .Net framework 4.7.2 projects.

TFS2015 Visual Studio Test: Could not load file or assembly

I have an "old" XAML Build Definition, made in Visual Studio; which builds a solution and following runs unit tests.
Now I've tried to make the same in the new TFS 2015 web surface.
I've created a build task, following Visual Studio Test.
But now the Test-Task exit with code 1 and gives me a lot of
"System.IO.FileNotFoundException: Could not load file or assembly" errors.
And also "Warning: MSTestAdapter failed to discover tests in class ..."
All the DLLs are where they have to be, the new definition has the same directory structure like the old one, but the test-task says there are missing assemblys.
Any ideas?
Update:
No, I still have the same error messages:
Warning: Unable to load types from the test source 'J:\xyz-Tests.dll'. Some or all of the tests in this source may not be discovered. If you are running unit tests for Windows Store apps and referencing custom WinMD type then please visit http://go.microsoft.com/fwlink/?LinkId=238340 for more info. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'xyz_Commons, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'xyz_Processing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'xyzCommons, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
This should exactly be the issue mentioned in below article, please try following the workaround to fix it:
Running Coded UI Tests built using Visual Studio 2013 with Team Foundation Server 2015
Test execution is failing in this scenario because test execution
engine is not able to resolve the old version binaries while executing
tests in a 14.0 environment (TFS 2015).
So, you need to update the projects to reference the new versions of the assemblies (VS 2015 in this scenario) using the assembly bindings in the test projects config file.
As a workaround to this issue, add an ‘app.config’ file to your
solution (See how to add app.config
https://msdn.microsoft.com/en-in/library/ms184658.aspx) and update the
contents of the file with the shared on OneDrive . The updated
configuration files contain assembly redirects from version 12.0 to
14.0, which will make sure that the test agent machine is able to resolve the framework assemblies. Check-in the updated configuration
file into the source control repository and run the BDT scenario once
again. The tests should run fine this time. If the test execution
again throws an error complaining version mismatch for some other
assembly, add the assembly to the app.config file and retry.
You can also reference this article :
http://www.dotnetcatch.com/2015/10/01/tfs-2010-to-2015-upgrade-codedui-feature-test-builds/

publish project in vs2013

I have a project that builds and is publish correctly before I moved to Windows 10. After I updated to Windows 10 I can build and test my project but I cannot publish my MVC project. It gives me the following error which I do not understand:
Could not load file or assembly 'Microsoft.Web.Deployment, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I added Microsoft.Web.Deployment from nuget but I still get the same error.
Following will solve your problem
Downloaded Web Deploy 3.5, from http://www.iis.net/downloads/microsoft/web-deploy
install complete package
Then open your project in VS 2013.
Publish your project.
Thanks

Getting MSBuild and CruiseControl .NET to build and deploy VS2010 database projects

I almost have a NAnt script together that will build and deploy VS2010 database projects, but one error stands in my way:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.TSqlTasks.targets(56,5): error MSB4062: The "SqlBuildTask" task could not be loaded from the assembly Microsoft.Data.Schema.Tasks.Sql, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or assembly 'Microsoft.Data.Schema.Tasks.Sql, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [xxx]
Failed to start MSBuild.
External Program Failed: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe (return code was 1)
I can see that the Microsoft.Data.Schema assemblies are not in the MSIL GAC on the build server - is there any clean way to do this without a full-freight installation of VS2010 on the build server?
For the curious, I asked Barclay Hill at Microsoft who answered this for me:
You can’t build database projects on
machines unless they have VS or TFS
2010 installed on them. It is not a
supported scenario. You can deploy
database project build outputs without
VS/TFS installed using vsdbcmd. The
only way to do this and be in line
with the licensing and support is to
install a local copy of VS Pro or
higher on your build box if not using
TFS.

Having trouble running code analysis from command prompt with msbuild

I'm using VS2010 RC while targeting .NET 3.5. I can run code analysis via Visual Studio without a problem. However, when I try to run code analysis on our CI server it isn't getting executed. When I attempt to build using msbuild 4.0 I get the following exception:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(129,9): error MSB4018: The "CodeAnalysis" task failed unexpectedly.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(129,9): error MSB4018: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Like I said, it works fine when I run it through VS.
You will have tough times to set this up...
I would install VS2010 on the build server. Problem solved.
Note:
The Build server should be a replication of your developer environment (not production environment)

Resources