Build of project fails on Visual Studio Team Services - missing lock file - build

I am trying to configure CI for my team project, however, my build doesn't get past the first library project. It is complaining about missing the lock file. I have configured nugget to restore but that doesn't seem to create the lock file. Git ignores the lock file so it is not put in repository.
Summary
| Build
3 error(s), 0 warning(s)
Build - 3 error(s), 0 warning(s)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(241):Project Core does not have a lock file.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(241):Project Core does not have a lock file.
Process 'msbuild.exe' exited with code '1'.
| Finalize build
0 error(s), 0 warning(s)
Does anyone know how to force build to create the lock file?
My solution is an ASP.NET Core RC2 website. It builds fine on VS 2015. Microsoft announce ASP.NET Core last week so it should be on the build servers, or do I have to create my own build server?
Here is the contents of my project.json file for the Core Library:
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNetCore.Identity": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"NETStandard.Library": "1.5.0-rc2-24027",
"NodaTime": "2.0.0-alpha20160523"
},
"frameworks": {
"netstandard1.5": {
"dependencies": {
"System.ComponentModel.Annotations": "4.1.0-rc2-24027"
},
"imports": [ "dnxcore50", "portable-net45+win8" ]
}
}
}

You can solve this by adding a new build step to your build definition.
Add a 'Command Line' task as step 1 of your build definition.
The settings for this task are:
Tool: dotnet
Arguments: restore
You can also speed this up a little by adding the following variable to your build definition:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE = true

Related

Build error with new UE5.1 project in Rider

I am just getting started with C++ in UE5.1. I am using Rider 2022.3.1
Upon trying to build the project in Rider, I get the following error:
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "D:\UE_5.1\Engine\Build\BatchFiles\Build.bat R2NAlaskaEditor Win64 Development -Project="C:\Users\..........R2NAlaska.uproject" -WaitMutex -FromMsBuild" exited with code 6. [C:\Users.....\R2NAlaska\Intermediate\ProjectFiles\R2NAlaska.vcxproj]
I've tried nuking the intermediate and VS folders and rebuilding the solution with no effect.
Here is the full build log:
Build started 1/28/2023 9:09:02 AM.
Logging verbosity is set to: Normal.Project "C:\Users\javor\Desktop\R2NAlaska\R2NAlaska.sln" on node 1 (Games\R2NAlaska target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Development Editor|Win64".
ValidateProjects:
The project "UE5" is not selected for building in solution configuration "Development Editor|Win64".
Project "C:\Users\javor\Desktop\R2NAlaska\R2NAlaska.sln" (1) is building "C:\Users\javor\Desktop\R2NAlaska\Intermediate\ProjectFiles\R2NAlaska.vcxproj" (2) on node 1 (default targets).
Build:
D:\UE_5.1\Engine\Build\BatchFiles\Build.bat R2NAlaskaEditor Win64 Development -Project="C:\Users\javor\Desktop\R2NAlaska\R2NAlaska.uproject" -WaitMutex -FromMsBuild
Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" R2NAlaskaEditor Win64 Development -Project="C:\Users\javor\Desktop\R2NAlaska\R2NAlaska.uproject" -WaitMutex -FromMsBuild
Log file: C:\Users\javor\AppData\Local\UnrealBuildTool\Log.txt
Unable to build while Live Coding is active. Exit the editor and game, or press Ctrl+Alt+F11 if iterating on code in the editor or game
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "D:\UE_5.1\Engine\Build\BatchFiles\Build.bat R2NAlaskaEditor Win64 Development -Project="C:\Users\javor\Desktop\R2NAlaska\R2NAlaska.uproject" -WaitMutex -FromMsBuild" exited with code 6. [C:\Users\javor\Desktop\R2NAlaska\Intermediate\ProjectFiles\R2NAlaska.vcxproj]
Done Building Project "C:\Users\javor\Desktop\R2NAlaska\Intermediate\ProjectFiles\R2NAlaska.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\javor\Desktop\R2NAlaska\R2NAlaska.sln" (Games\R2NAlaska target(s)) -- FAILED.
Build FAILED.
"C:\Users\javor\Desktop\R2NAlaska\R2NAlaska.sln" (Games\R2NAlaska target) (1) ->
"C:\Users\javor\Desktop\R2NAlaska\Intermediate\ProjectFiles\R2NAlaska.vcxproj" (default target) (2) ->
(Build target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "D:\UE_5.1\Engine\Build\BatchFiles\Build.bat R2NAlaskaEditor Win64 Development -Project="C:\Users\javor\Desktop\R2NAlaska\R2NAlaska.uproject" -WaitMutex -FromMsBuild" exited with code 6. [C:\Users\javor\Desktop\R2NAlaska\Intermediate\ProjectFiles\R2NAlaska.vcxproj]
0 Warning(s)
1 Error(s)
Note that is warns about Live Coding and exiting the engine, but the engine was not running during these builds.

Unable to load application or execute command 'Microsoft.Dnx.TestHost'. Available commands: test

Trying to test an ASPNET 5 application in VS2015.
{
"version": "1.0.0-*",
"description": "HoldingTank Class Library",
"dependencies": {
"EntityFramework.InMemory": "7.0.0-rc1-final",
"FluentAssertions": "4.1.1",
"GenFu": "1.0.4",
"MyMVCProject": "1.0.0-*",
"xunit": "2.1.0",
"xunit.runner.visualstudio": "2.1.0"
},
"commands": {
"test": "xunit.runner.dnx"
},
"frameworks": {
"dnx451": { }
}
}
However, no tests show up in the Test Explorer window and when I hit F5 I get:
------ Discover test started ------
------ Test started: Project: HoldingTank ------
Starting Microsoft.Dnx.TestHost [C:\Users\erik\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnx.exe --appbase "C:\code\PortalSolution\src\HoldingTank" Microsoft.Dnx.ApplicationHost --port 52620 Microsoft.Dnx.TestHost --port 56351 --parentProcessId 8368]
Error: Unable to load application or execute command 'Microsoft.Dnx.TestHost'. Available commands: test.
Unable to start Microsoft.Dnx.TestHost
========== Discover test finished: 0 found (0:00:01.8238001) ==========
I just have one test, decorated with [Fact] but it doesn't look like it is getting that far.
Looking at similar questions that have "unable to load" errors (but couldn't find any specific to TestHost), I've tried making sure that both the test project and the application target the same frameworks, but couldn't find any discrepancies. And I don't see anything in the Event Log.
Any suggestions? - not even sure where to go to start to troubleshoot this.
You have to add the "xunit.runner.dnx" as dependency instead of the "xunit.runner.visualstudio". Then it will work in VisualStudio.
Since ASP.Net 5 is in beta, so is xunit.runner.dnx. Use the current pre-release which matches ASP.Net RC1 ... I currently use 2.1.0-rc1-build204 with ASP.Net 5 RC1

XUnit in Visual Studio 2015 RC1 Update 1 doesn't find tests

I created an ASP.NET 5 project in Visual Studio 2015, using the Preview Templates. I installed XUnit via NuGet, and I added an "xUnit Test Project (DNX)" to my solution.
But my Test Explorer shows nothing, even though I have a public "Fact" test method in Class1.cs. When I "Run All Tests", the "Tests" output window is blank. My "Build" output window shows that 2 project build succeeds. (My ASP.NET 5 project, and my xUnit project.)
When I either build or clean my solution, however, I get the following message in the "Tests" output window:
------ Discover test started ------
------ Test started: Project: MyProjectTest ------
Starting Microsoft.Dnx.TestHost [C:\Users\xxxxxx\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnx.exe --appbase "C:\Users\xxxxxx\Documents\GitForWindows\Repositories\MySolution\MyProjectTest" Microsoft.Dnx.ApplicationHost --port 8424 Microsoft.Dnx.TestHost --port 8458 --parentProcessId 17312]
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Dnx.TestHost.Program.<>c__DisplayClass2_0.<<Main>b__0>d.MoveNext()
Unable to start Microsoft.Dnx.TestHost
========== Discover test finished: 0 found (0:00:01.057196) ==========
My solution DNX SDK version, according to both projects' properties window, is 1.0.0-rc1-update1. I also set that as the "active" runtime via dnvm, with no change in the above behavior. I don't understand the instructions about running DNX from the command line, though, so perhaps that's a starting point?
When I try switching DNX SDK to 1.0.0-beta5, instead, and clean solution, I get:
------ Discover test started ------
------ Test started: Project: MyProjectTest ------
Starting Microsoft.Framework.TestHost [C:\Users\xxxxx\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta5\bin\dnx.exe --appbase "C:\Users\xxxxxx\Documents\GitForWindows\Repositories\MySolution\MyProjectTest" Microsoft.Framework.ApplicationHost --port 9737 Microsoft.Framework.TestHost --port 9770 --parentProcessId 16732]
System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
xunit 2.1.0
xunit.runner.dnx 2.1.0-beta6-build191
Searched Locations:
C:\Users\xxxxx\Documents\GitForWindows\Repositories\MySolution\{name}\project.json
C:\Users\xxxxx\Documents\GitForWindows\Repositories\MySolution\src\{name}\project.json
C:\Users\xxxxx\Documents\GitForWindows\Repositories\MySolution\test\{name}\project.json
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\{name}.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\{name}.dll
C:\Windows\Microsoft.NET\assembly\GAC_32\{name}\{version}\{name}.dll
C:\Windows\Microsoft.NET\assembly\GAC_64\{name}\{version}\{name}.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\{name}\{version}\{name}.dll
Try running 'dnu restore'.
at Microsoft.Framework.Runtime.DefaultHost.GetEntryPoint(String applicationName)
at Microsoft.Framework.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
at Microsoft.Framework.ApplicationHost.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at dnx.host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env)
at dnx.host.RuntimeBootstrapper.ExecuteAsync(String[] args)
at dnx.host.RuntimeBootstrapper.Execute(String[] args)
Unable to start Microsoft.Framework.TestHost
========== Discover test finished: 0 found (0:00:01.4699978) ==========
Running DNU restore doesn't resolve anything.
EDIT: Here's the project.json as requested:
{
"version": "1.0.0-*",
"description": "",
"authors": [ "" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"xunit": "2.1.0",
"xunit.runner.dnx": "2.1.0-beta6-build191"
},
"commands": {
"test": "xunit.runner.dnx"
},
"frameworks" : {
"dnx451": { },
"dnxcore50" : {
"dependencies": {
"System.Collections": "4.0.11-beta-23225",
"System.Linq": "4.0.1-beta-23225",
"System.Threading": "4.0.11-beta-23225",
"Microsoft.CSharp": "4.0.1-beta-23225"
}
}
}
}
You need to use a version of xUnit runner that matches dnx. For dxn RC1 you need to use the version 2.1.0-rc1-build204 of xunit.runner.dnx

Windows 8 store app unit tests fail in VS 2012

I am developing a Windows 8 store app. I added unit tests by choosing Solution >> Add >> new project >> Unit Test Library (Windows Store apps). I am then able to run the tests fine.
However, I then add a reference to my original Windows 8 store app project (following the instructions here), and when I try to run the tests again, I get the following error:
------ Discover test started ------
WriteTestCaseStarted
WriteTestCase Took Time = 3.0004
========== Discover test finished: 1 found (0:00:00.1350024) ==========
------ Run test started ------
Updating the layout...
Copying files: Total <1 mb to layout...
Registering the application to run from layout...
Deployment complete. Full package name: "c078c431-2a0d-4494-8dd9-47ae01ac938d_1.0.0.0_neutral__chny7cy2kxrnj"
Exception has been thrown by the target of an invocation.
========== Run test finished: 0 run (0:00:01.8770198) ==========
What am I doing wrong?
Update: Commenting out the following line from App.xaml solved the problem:
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
Why?
Multiple things can cause this. Here are a couple I've found:
Application tag in app.xaml setting any properties (like RequestedTheme)
App.xaml referencing a ResourceDictionary which uses custom attached properties.
Try commenting out contents of App.xaml to see if that helps.

c++ Random unexplained error

I'm creating a kinect project in Visual Studio 2008 using OpenNi, NITE and OpenGL.
At random times dureing development I get the following error:
Error result 1 returned from 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\rc.exe'.
I've searched the internet with no luck.
I am able to create a new project and copy all my code across and it works fine but this is not something I want to be doing multiple times each day.
If any more info is required I'd be happy to give it.
EDIT full output window reads
1>------ Build started: Project: PointViewer, Configuration: Debug Win32 ------
1>Compiling resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>fatal error RC1110: could not open ..\Res\NITE.rc
1>Project : error PRJ0002 : Error result 1 returned from 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\rc.exe'.
1>Build log was saved at "file://d:\Documents\Uni work\Year 4\Personal Project\Samples \PointViewer\Debug\BuildLog.htm"
1>PointViewer - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
You are referencing your RC file via a relative path (..).
It seems likely your current directory is changing, and hence .., and the path to your RC file changes, causing the error.
You will have to make sure that your RC file is referred to in a way that doesn't change.
Try removing it from the project, and re-adding it, taking care to refer to it only in absolute terms.
Check your project and build settings for the directory where the build is to start, and how the filename is preserved in the project settings. You're looking for something like "Persist Filenames As...".
I had the same error. Move your entire project folder into documents/visualstudio/projects. If that doesn't work, move it to your desktop. It is just a linking problem, it can't find the resources. Make sure you aren't moving your folders around as this can cause these issues.
A possible reason for the error described - .rc file was renamed.
Check the .rc file name in your .vcproj file and see that it actually exists on disk.