Dear all,
I have .Net Core project which has been converted with Visual Studio 2017.
The build plan especially the task NuGet Restore worked for that one before the migration.
Afterwards the build fails with the error:
May you please check and if possible fix this?
Best regards, matthias
ok, the dotnet restore task is working, but it still seems like a bug(for me)...
so close if as expected ;)
The downside to dotnet restore
is that it does not work with VSTS's authenticated feeds. We would need NuGet 4.0 to work with both authenticated feeds and VS2017 csproj, which I believe is part of the ask in #3756.
For builds running on Windows, using NuGet 4 (which is now available in the NuGet Installer task) is the recommended way to restore packages. Longer term, we're looking into how dotnet can best work with authenticated feeds like VSTS.
Setting up CI in Azure for my Core MVC project and running into this error. What is the recommended solution?
Here's how to enable tool installers (what @alexmullans referred to above)
I think nuget one should be there now. If not, coming to your scale unit soon.
@bryanmacfarlane The url doesn't have any video content.
I tried to use NuGet 4.0 and that results in this build error
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\build*netstandard1.0*\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeployPackage.targets(124,7): Error MSB4184: The expression "[System.IO.Path]::GetDirectoryName('')" cannot be evaluated. The path is not of a legal form.
My project is netcoreapp1.1
and .NET 4.5.2
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>
Edit: Using NuGet 3.5.0 I get another error message
2017-05-05T07:13:47.3908531Z [command]C:\a\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.5.0\NuGet.exe restore -NonInteractive C:\a\1\s\i2M.WebApp.sln
2017-05-05T07:13:49.5013000Z Failed to load msbuild Toolset
2017-05-05T07:13:49.5013000Z Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
2017-05-05T07:13:49.5256477Z ##[debug]rc:1
2017-05-05T07:13:49.5256477Z ##[debug]success:false
2017-05-05T07:13:49.5336572Z ##[error]Error: C:\a\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.5.0\NuGet.exe failed with return code: 1
2017-05-05T07:13:49.5336572Z ##[debug]Processed: ##vso[task.issue type=error;]Error: C:\a\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.5.0\NuGet.exe failed with return code: 1
2017-05-05T07:13:49.5336572Z ##[debug]task result: Failed
2017-05-05T07:13:49.5346515Z ##[error]Packages failed to install
@joacar are you using any private repositories, or only packages from nuget.org? If the latter, you can use dotnet restore, which should get you working.
@alexmullans I disabled the **uGet restore**-task and replaced it with **dotnet restore** (arguments
/.csproj`) and that step is running to completion but the build step is failing.
Will try to replace it with dotnet build
Update It works with dotnet build
. Now time to tackle Publish to Azure (next step after test) why the .zip
is created. Not a perfect template for ASP.NET Core
since it doesn't work very well...
Update 2
So after properly building all projects but not creating a zip
I tried to pass arguments to dotnet build
namely /p:DeployOnBuild=true /p:PackageAsSingleFile=true /p:WebPublishMethod=Package /p:PackageLocation=$(build.artifactstagingdirectory)
. Then I got the error message below.
017-05-08T11:55:45.9195458Z C:\Program Files\dotnet\sdk\1.0.2\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeployPackage.targets(137,5): warning MSB3371: The file "\i2M.WebApp.SourceManifest.xml" cannot be created. Access to the path 'C:\i2M.WebApp.SourceManifest.xml' is denied. [C:\a\1\s\src\i2M.WebApp\i2M.WebApp.csproj]
2017-05-08T11:55:45.9195458Z C:\Program Files\dotnet\sdk\1.0.2\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeployPackage.targets(137,5): warning MSB3371: The file "\i2M.WebApp.Parameters.xml" cannot be created. Access to the path 'C:\i2M.WebApp.Parameters.xml' is denied. [C:\a\1\s\src\i2M.WebApp\i2M.WebApp.csproj]
2017-05-08T11:55:45.9365468Z C:\Program Files\dotnet\sdk\1.0.2\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeployPackage.targets(162,5): error MSB4062: The "CreateManifestFile" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\1.0.2\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\..\..\tools\netcoreapp1.0\\Microsoft.NETCore.Sdk.Publish.Tasks.dll. 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. [C:\a\1\s\src\i2M.WebApp\i2M.WebApp.csproj]
Update 3
Removed the DeployOnBuild and now it builds propertly but the zip
is stille nowhere to be found when the deploy step is running. Getting closer at least...
2017-05-08T11:08:05.5484278Z Build FAILED.
2017-05-08T11:08:05.5524283Z
2017-05-08T11:08:05.5534280Z "C:\a\1\s\i2M.WebApp.sln" (default target) (1) ->
2017-05-08T11:08:05.5534280Z "C:\a\1\s\src\i2M.WebApp\i2M.WebApp.csproj" (default target) (2) ->
2017-05-08T11:08:05.5534280Z "C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj" (default target) (3:2) ->
2017-05-08T11:08:05.5534280Z (CoreCompile target) ->
2017-05-08T11:08:05.5534280Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(14,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5534280Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(15,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5534280Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(16,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(17,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(18,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(19,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(20,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(21,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(14,55): error CS0518: Predefined type 'System.String' is not defined or imported [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(15,61): error CS0518: Predefined type 'System.String' is not defined or imported [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(16,59): error CS0518: Predefined type 'System.String' is not defined or imported [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(17,59): error CS0518: Predefined type 'System.String' is not defined or imported [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(18,68): error CS0518: Predefined type 'System.String' is not defined or imported [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(19,55): error CS0518: Predefined type 'System.String' is not defined or imported [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(20,53): error CS0518: Predefined type 'System.String' is not defined or imported [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(21,55): error CS0518: Predefined type 'System.String' is not defined or imported [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(11,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5544291Z obj\Debug\netstandard1.4\i2M.Domain.AssemblyInfo.cs(12,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5584611Z
2017-05-08T11:08:05.5584611Z
2017-05-08T11:08:05.5584611Z "C:\a\1\s\i2M.WebApp.sln" (default target) (1) ->
2017-05-08T11:08:05.5584611Z "C:\a\1\s\src\i2M.WebApp\i2M.WebApp.csproj" (default target) (2) ->
2017-05-08T11:08:05.5584611Z "C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj" (default target) (3:2) ->
2017-05-08T11:08:05.5584611Z (GenerateBuildDependencyFile target) ->
2017-05-08T11:08:05.5584611Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Assets file 'C:\a\1\s\src\i2M.Domain\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\a\1\s\src\i2M.Domain\i2M.Domain.csproj]
2017-05-08T11:08:05.5584611Z
2017-05-08T11:08:05.5584611Z
2017-05-08T11:08:05.5584611Z "C:\a\1\s\i2M.WebApp.sln" (default target) (1) ->
2017-05-08T11:08:05.5584611Z "C:\a\1\s\src\i2M.WebApp\i2M.WebApp.csproj" (default target) (2) ->
2017-05-08T11:08:05.5584611Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Assets file 'C:\a\1\s\src\i2M.WebApp\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\a\1\s\src\i2M.WebApp\i2M.WebApp.csproj]
2017-05-08T11:08:05.5584611Z
2017-05-08T11:08:05.5584611Z
2017-05-08T11:08:05.5584611Z "C:\a\1\s\i2M.WebApp.sln" (default target) (1) ->
2017-05-08T11:08:05.5584611Z "C:\a\1\s\test\i2M.WebApp.Tests\i2M.WebApp.Tests.csproj" (default target) (4) ->
2017-05-08T11:08:05.5584611Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Assets file 'C:\a\1\s\test\i2M.WebApp.Tests\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\a\1\s\test\i2M.WebApp.Tests\i2M.WebApp.Tests.csproj]
2017-05-08T11:08:05.5584611Z
2017-05-08T11:08:05.5584611Z 0 Warning(s)
2017-05-08T11:08:05.5584611Z 21 Error(s)
2017-05-08T11:08:05.5624547Z
@matttrakker
dotnet restore
is working, but it's weird, just a workaround.
dotnet restore is the right thing to use here. In an upcoming sprint, we'll be updating the dotnet task to work with authenticated feeds.
If you need authenticated feed support with .NET Core projects today, there are two steps:
Closing this for now. The updated dotnet task (with support for authenticated feeds) should land in the next deployment (3.5ish weeks). Please keep an eye out for that and give it a shot.
How do you add dotnet restore task? I am having the same issue after adding a new .Net Core 2.0 project to the existing .Net 4.7 projects solution.
Look for the .NET Core task in the catalog, and select Version 2.* from the version picker.
I need to use .NET Core with authenticated VSTS nuget feed? I am getting a 401 error now. How do i authenticate with user name and VSTS PAT?
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : Unable to load the service index for source https://vsts.url.com/nuget/v3/index.json. [d:\a\1\s\myproject.csproj]
2017-09-05T15:06:52.4907364Z C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : Response status code does not indicate success: 401 (Unauthorized). [d:\a\1\s\myproject.csproj]
Are you trying to use .NET Core in build or on your local machine? If the latter: https://www.visualstudio.com/en-us/docs/package/nuget/dotnet-exe
I'm facing the exact same issue. I tried many ways but the build is still failing.
I've created a stack-overflow question.
https://stackoverflow.com/questions/46155449/use-vsts-to-build-a-solution-with-vsts-packages-and-old-style-csproj
Thanks,
I resolved my own issue by using NuGet Tool Installer and install Nuget 4.3.0 instead of 4.1.0
It's working fine for me:
Aspnet core 2.0
If you don't have VSTS, but just TFS then there is a recommended way to get NuGet 4.3.x
https://blogs.msdn.microsoft.com/devops/2017/09/29/using-the-latest-nuget-in-your-build/
What if I am trying to build using docker image _microsoft/aspnetcore:1.0-2.0_ ?
_dotnet restore_ just ignores the credentials from nuget.config in the project/solution dir.
Any way to build with private NuGet feeds?
I'm not super-familiar with the docker image you referenced, but you might try passing the --configFile
Yet another one of those amazing GitHub threads that pops up when you Google some absurd issue with the buggy Visual-Studio-Of-The-Week drop.
@alexmullans self-assigns the bug, closes it before a fix is shipped, and here it sits for months.
See this over and over in Microsoft's absurd use of GitHub. Stop it!
@CleberDSantos and in nuget restore what did you put?... custom?... thanks in advance
@FernandoAguilarR
Hey guys, i know this is closed but I have an existing solution that I recently added a brand new nodejs project to (using the out of the box template from VS) ... I told it to add that to source control and attempted a check in to which the build server (delegated by VSTS, all up to date with VS 2017 and nuget 4.6) responded with this ...
2018-03-20T14:34:17.4906031Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(154,5): Error : Assets file 'C:\BuildAgent\_work\1\s\Dev\Shell\NodeApp\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
based on the advice given above I added a dotnet restore command following the get sources step and it made no difference ... same exception.
Is there a patch expected for this or a work around?
from above dated july 12th 2017 ... @alexmullans ...
Closing this for now. The updated dotnet task (with support for authenticated feeds) should land in the next deployment (3.5ish weeks). Please keep an eye out for that and give it a shot.
... still looks pretty broken to me :(
I also noticed some weird stuff ...
The dotnet step / command asks for "path to project(s)" and a build step asks for "Solution".
The former i noticed is attaching the pattern match as a physical path search where as the latter is expecting a virtual path.
Can you guys please try to be more consistent in the future, perhaps it might be best to always use virtual paths?
@TehWardy are you using dotnet restore and then Visual Studio Build? Not sure that'll work. You'll probably want to use either NuGet + Visual Studio Build (for .NET Framework projects) or dotnet restore and dotnet build (for .NET Core projects). Solution is a concept in .NET Framework that is mostly unused in .NET Core, which is why the different tasks use different text.
If that still doesn't work, please feel free to open a question on Developer Community.
oh ok ... I use VS build and did have a nuget restore step in the process prior to adding a dotnet restore step.
I've noticed all my old solution even if I do a clean up of the build cache on the build server seems to build fine without a nuget or dotnet restore step in the process ... in fact a nuget restore step comes up with build warnings actively saying "dot use this, it's redundant".
Either way both restoration steps result in the same build failure.
I'll raise my question over on the dev community but this feels like a bug to me as dotnet core projects appear to not work in the same way that older dot net projects worked "out of the box" with a standard VS build step.
Just remove the local repo from
C:\Users\<username>\Documents\Visual Studio 2017\Projects\Chromely\src\nuget.config
with a text-editor, and it will work.
nothing worked as suggested on this website..cant believe there is no solution of this issue
@abhijeetsinha9 This was solved a while ago ...
These days I don't do a restore at all for .Net core projects I just do a build or publish and that does the restore for you.
There is a bit of a gotcha though ... if using cloud based build servers provided by Microsoft they change the versions of .Net Core often as a result of ongoing progress so if you don't keep up you start to find older projects break.
The fix is simply to migrate your project to the latest .Net Core version.
Most helpful comment
It's working fine for me:
Aspnet core 2.0