locked
csproj: The file type was not recognized RRS feed

  • Question

  • I've got a VS2017 .Net Core 1.1 project and I am evaluating Team Services for our team. Project builds just fine locally. When using Team Services it failes on restore part:

    2017-03-09T08:04:16.6937172Z [command]C:\Program Files\dotnet\dotnet.exe restore D:\a\1\s\MyProj\MyProj.csproj
    2017-03-09T08:04:16.8917171Z error: Invalid input 'D:\a\1\s\MyProj\MyProj.csproj'. The file type was not recognized.
    2017-03-09T08:04:16.8917171Z ##[error]Dotnet command failed with non-zero exit code: 1.
    2017-03-09T08:04:16.9927174Z ##[section]Finishing: Restore

    What should I do?

    Thursday, March 9, 2017 8:14 AM

All replies

  • Even following steps provided in here, won't work. Then I just get "project.json not found", but there is no project.json since VS2017 wanted it removed.


    Thursday, March 9, 2017 2:06 PM
  • I thought I'd mention I'm having the same problem.  You're not alone.

    I think the problem might be related to the hosted build agent using an older version of the dotnet core tool set.  If that's the problem, I don't know what we can do about it.

    • Edited by Mike010 Thursday, March 9, 2017 4:23 PM more detail
    Thursday, March 9, 2017 4:16 PM
  • Look here for details:  https://github.com/Microsoft/vsts-tasks/issues/3311

    Basically MS demoed a feature during the keynote that doesn't really work yet.

    Thursday, March 9, 2017 5:47 PM
  • What exactly you are trying to do, like: build or release? 
    Which task are you using which is failing?
    Get the logs of build with system.debug to true, which will help to resolve your issue.
    Provide us the screenshot of the way tasks are defined
    if you are passing csproj as argument to the task, don’t use that.
    Any repro which we can look at?
    Tuesday, March 14, 2017 7:13 AM
  • Hi!

    It's done exactly like here:

    https://www.visualstudio.com/en-us/docs/build/apps/aspnet/aspnetcore-to-azure

    Project is a .Net Core 1.1 application which VS2017 converted from project.json to .csproj.

    restore part doesn't find any projects:

    2017-03-14T08:05:59.7336317Z ##[section]Starting: Run dotnet restore
    2017-03-14T08:05:59.7836437Z ==============================================================================
    2017-03-14T08:05:59.7836437Z Task         : Command Line
    2017-03-14T08:05:59.7836437Z Description  : Run a command line with arguments
    2017-03-14T08:05:59.7836437Z Version      : 1.1.2
    2017-03-14T08:05:59.7836437Z Author       : Microsoft Corporation
    2017-03-14T08:05:59.7836437Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
    2017-03-14T08:05:59.7836437Z ==============================================================================
    2017-03-14T08:05:59.8706445Z ##[command]dotnet restore
    2017-03-14T08:06:01.5300305Z 
    2017-03-14T08:06:01.5320299Z Welcome to .NET Core!
    2017-03-14T08:06:01.5320299Z ---------------------
    2017-03-14T08:06:01.5320299Z Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.
    2017-03-14T08:06:01.5320299Z Telemetry
    2017-03-14T08:06:01.5320299Z --------------
    2017-03-14T08:06:01.5320299Z The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include commandline arguments. The data is collected by Microsoft and shared with the community.
    2017-03-14T08:06:01.5320299Z You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
    2017-03-14T08:06:01.5330305Z You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
    2017-03-14T08:06:01.5330305Z Configuring...
    2017-03-14T08:06:01.5330305Z -------------------
    2017-03-14T08:06:01.5330305Z A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.
    2017-03-14T08:06:06.8006839Z Decompressing 0%Decompressing 1%Decompressing 2%Decompressing 3%Decompressing 4%Decompressing 5%Decompressing 6%Decompressing 7%Decompressing 8%Decompressing 9%Decompressing 10%Decompressing 11%Decompressing 12%Decompressing 13%Decompressing 14%Decompressing 15%Decompressing 16%Decompressing 17%Decompressing 18%Decompressing 19%Decompressing 20%Decompressing 21%Decompressing 22%Decompressing 23%Decompressing 24%Decompressing 25%Decompressing 26%Decompressing 27%Decompressing 28%Decompressing 29%Decompressing 30%Decompressing 31%Decompressing 32%Decompressing 33%Decompressing 34%Decompressing 35%Decompressing 36%Decompressing 37%Decompressing 38%Decompressing 39%Decompressing 40%Decompressing 41%Decompressing 42%Decompressing 43%Decompressing 44%Decompressing 45%Decompressing 46%Decompressing 47%Decompressing 48%Decompressing 49%Decompressing 50%Decompressing 51%Decompressing 52%Decompressing 53%Decompressing 54%Decompressing 55%Decompressing 56%Decompressing 57%Decompressing 58%Decompressing 59%Decompressing 60%Decompressing 61%Decompressing 62%Decompressing 63%Decompressing 64%Decompressing 65%Decompressing 66%Decompressing 67%Decompressing 68%Decompressing 69%Decompressing 70%Decompressing 71%Decompressing 72%Decompressing 73%Decompressing 74%Decompressing 75%Decompressing 76%Decompressing 77%Decompressing 78%Decompressing 79%Decompressing 80%Decompressing 81%Decompressing 82%Decompressing 83%Decompressing 84%Decompressing 85%Decompressing 86%Decompressing 87%Decompressing 88%Decompressing 89%Decompressing 90%Decompressing 91%Decompressing 92%Decompressing 93%Decompressing 94%Decompressing 95%Decompressing 96%Decompressing 97%Decompressing 98%Decompressing 99%Decompressing 100% 5188 ms
    2017-03-14T08:06:37.6740099Z Expanding 0%Expanding 1%Expanding 2%Expanding 3%Expanding 4%Expanding 5%Expanding 6%Expanding 7%Expanding 8%Expanding 9%Expanding 10%Expanding 11%Expanding 12%Expanding 13%Expanding 14%Expanding 15%Expanding 16%Expanding 17%Expanding 18%Expanding 19%Expanding 20%Expanding 21%Expanding 22%Expanding 23%Expanding 24%Expanding 25%Expanding 26%Expanding 27%Expanding 28%Expanding 29%Expanding 30%Expanding 31%Expanding 32%Expanding 33%Expanding 34%Expanding 35%Expanding 36%Expanding 37%Expanding 38%Expanding 39%Expanding 40%Expanding 41%Expanding 42%Expanding 43%Expanding 44%Expanding 45%Expanding 46%Expanding 47%Expanding 48%Expanding 49%Expanding 50%Expanding 51%Expanding 52%Expanding 53%Expanding 54%Expanding 55%Expanding 56%Expanding 57%Expanding 58%Expanding 59%Expanding 60%Expanding 61%Expanding 62%Expanding 63%Expanding 64%Expanding 65%Expanding 66%Expanding 67%Expanding 68%Expanding 69%Expanding 70%Expanding 71%Expanding 72%Expanding 73%Expanding 74%Expanding 75%Expanding 76%Expanding 77%Expanding 78%Expanding 79%Expanding 80%Expanding 81%Expanding 82%Expanding 83%Expanding 84%Expanding 85%Expanding 86%Expanding 87%Expanding 88%Expanding 89%Expanding 90%Expanding 91%Expanding 92%Expanding 93%Expanding 94%Expanding 95%Expanding 96%Expanding 97%Expanding 98%Expanding 99%Expanding 100% 30547 ms
    2017-03-14T08:07:12.1085404Z warn : The folder 'D:\a\1\s' does not contain a project to restore.
    2017-03-14T08:07:12.1225405Z ##[section]Finishing: Run dotnet restore

    Build step fails with:

    2017-03-14T08:07:23.8308133Z "D:\a\1\s\MyProj\MyProj.csproj.metaproj" (default target) (2) ->
    2017-03-14T08:07:23.8308133Z (Build target) -> 
    2017-03-14T08:07:23.8308133Z   D:\a\1\s\MyProj\MyProj.csproj.metaproj : warning MSB4078: The project file "MyProj\MyProj.csproj" is not supported by MSBuild and cannot be built.

    Same kind of thing happens with .net core preview build tools. But as said above, the problem probably lies in that hosted agent is out of date.

    Tuesday, March 14, 2017 8:16 AM
  • A temp workaround is to download the latest version of the .net core sdk and use it.

    You can add an inline powershell script to do the job (https://pgroene.wordpress.com/2016/05/20/using-the-inline-powershell-vsts-task).

    Run Inline Powershell
    Script to run
    Invoke-WebRequest https://go.microsoft.com/fwlink/?linkid=843454 -OutFile $(System.DefaultWorkingDirectory)\dotnet.zip

    Extract Files
    Archive file patterns
    $(System.DefaultWorkingDirectory)\dotnet.zip
    Destination folder
    $(System.DefaultWorkingDirectory)\dotnet

    Command Line
    Tool
    $(System.DefaultWorkingDirectory)\dotnet\dotnet.exe
    Arguments
    restore / build --configuration $(BuildConfiguration) / test / publish ...
    * don't forget to specify the working folder

    And follow the article previously posted https://www.visualstudio.com/en-us/docs/build/apps/aspnet/aspnetcore-to-azure


    • Edited by fdehu Tuesday, March 14, 2017 11:39 AM
    Tuesday, March 14, 2017 10:17 AM
  • Thanks fdehu. This actually works, though had to do some settings changes. For example I have to call the tool like this:

    $(System.DefaultWorkingDirectory)\dotnet\dotnet

    Wednesday, March 15, 2017 7:36 AM
  • Hmm, do you have any clue why this method doesn't have access to the VSTS private nuget server? Works fine with the default dotnet that comes with the agent.
    Thursday, March 16, 2017 11:50 AM
  • I too now have problems with Nuget Publishing. I use dotnet pack to make the nuget, but can't publish it. Just getting Internal server error 500, which is always nice to debug...
    Thursday, March 16, 2017 3:51 PM
  • Create a technical support ticket here: https://www.visualstudio.com/team-services/support/, our engineers would assist you properly.  
    Friday, March 17, 2017 6:09 AM
  • As mentioned earlier, we would suggest to create a technical support ticket as our engineers would need sensitive information. 

    Friday, March 17, 2017 8:43 AM
  • I had the same issue. it was solved by using Hosted VS2017 build agent then everything worked :) 
    Wednesday, May 31, 2017 8:46 PM
  • I had the same issue. it was solved by using Hosted VS2017 build agent then everything worked :) 
    Yes. I had the same issue and it was solved by changing the default agent queue to Hosted VS2017. In fact Microsoft  has pointed this out in their documentation here :)
    Tuesday, June 6, 2017 9:18 PM
  • Glad to know that your issue has been resolved.
    Wednesday, June 7, 2017 12:17 PM