Wcf: Dotnet-svcutil & VS extension fails with dotnet 1.1

Created on 17 Nov 2016  路  21Comments  路  Source: dotnet/wcf

The dotnet-svcutil.exe tool keeps failing on me. The error in the VS from _Visual Studio WCF Connected Service_ extension is:

Scaffolding Code ...
Error:Error: MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
An error occurred while bootstrapping svcutil. This usually happens when processing references.  You might be able to work around this problem by not providing reference parameters, and manually removing any types redefined in the generated proxy code.

Failed to generate service reference.

Reading in the comments at the announcement page I have tried digging into the internals at: C:\Users\<name>\AppData\Local\Temp\WCFConnectedService\2016_Nov_17_16_07_08\svcutil_bootstrap\dotnet-svcutil

From the console doing dotnet -v restore . fails with:
Error: MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

So I dug deeper, and found out that since I have dotnet 1.1 it looks for csproj at restore. So I put in the sdk in the global.json at 2016_Nov_17_16_07_08\svcutil_bootstrap. But the command actually overwrites that global.json. Any pointers on how to use this extension with the latest bits?

Note: have copied this comment over from that page for greater visibility

tooling

All 21 comments

Thanks for reporting the issue @aateeque. We are working on an update that will add the support for .NET Core 1.1 and will be released shortly. In the meanwhile, as a workaround, can you please change your project to 1.0, generate service reference with the tool and then update your project and its referenced packages to 1.1 (for System.ServiceModel.* packages, it will be 4.3.0)?

Hi @aateeque, we just released an update to the WCF Connected Service that added support for .NET Core/ASP.NET Core 1.1. Please let us know if you run into any issues. Thank you!

@zhenlan it worked! Thanks for a quick turnaround

@zhenlan I'm still getting this error with 0.4.21213.0

@masaeedu is it possible you can share a simplified repo? We will then take a look. Thank you!

@zhenlan I'm just creating a blank .Net Core class library project and trying to add the service reference. The problem once again seems to be that the global.json in C:\Users\asaeeduddin\AppData\Local\Temp\WCFConnectedService\2017_Jan_25_15_54_04\svcutil_bootstrap looks like this:

{
  "projects": [
    "D:/depot/untracked/ClassLibrary1/src"
  ]
}

with no version locking to the preview2 sdk. Either the global.json needs to have:

  "sdk": {
    "version": "1.0.0-preview2-003131"
  }

Or the global.json and project.json need to be replaced with .sln and .csproj respectively.

For anyone else running into this who needs a quick hack. Simply go to C:\Program Files\dotnet\sdk and temporarily rename any sdk versions above 2.1 so that a .json project format compatible SDK is used.

Seems changing project.json into:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
  },
  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ],
      "dependencies": {
        "System.ServiceModel.Duplex": "4.0.1",
        "System.ServiceModel.Http": "4.1.0",
        "System.ServiceModel.NetTcp": "4.1.0",
        "System.ServiceModel.Security": "4.0.1",
        "System.Xml.XmlSerializer": "4.0.11"
      }
    }
  },
  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },
  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  }
}

helps to generate, but breaks "Data Type Options" tab- "Error parsing JSON File ..."

@masaeedu I gave this a try with a .NET Core class library created out of default template in VS2015. Here is how my project.json looks like.

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.6.0"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

The WCF Connected Service worked just fine. Please note, as mentioned in this blog post, it is not recommended to upgrade to netstandard 1.6.1 for class library (search Upgrading .NET Standard Library Projects). The tool will fail if the class library targets netstandard1.6.1.

BTW, I have both 1.0.0-preview2-003131 and 1.0.0-preview2-1-003177 installed on my machine and my class library uses 1.0.0-preview2-003131 in global.json.

cc: @mlacouture @hongdai, FYI

helps to generate, but breaks "Data Type Options" tab- "Error parsing JSON File ..."

@krzycho1024 not sure I follow. How can I get to "Data Type Options" tab?

@zhenlan AFAIK 1.0.0-preview2-1-003177 is also compatible with project.json and global.json, so you wouldn't see the issue if this is the highest version you have installed. If you install Visual Studio 2017, you'll get a higher version (I think right now RC3), which only supports csproj and has no support for project.json/global.json.

It seems the VSIX tool generates a global.json in a temp folder (C:\Users\asaeeduddin\AppData\Local\Temp\WCFConnectedService\2017_Jan_25_15_54_04\svcutil_bootstrap) at some intermediate step, but does not version lock it to the correct SDK version (2.1 or below). When it tries to build this directory, it gets an error because the now-latest SDK on my machine is incompatible with project.json style projects.

@masaeedu thank you. I see what you mean now. We did not consider this SDK breaking change when we initially created the WCF Connected Service for VS2015. We probably could lock the temp project to the same SDK version of the user project. Now in VS2017, with the global.json going away, hopefully this is not an issue anymore when we have the WCF Connected Service for VS2017 available, but we will need to make sure this is the case. Thanks again for pointing this out.

cc: @mlacouture @hongdai

@zhenlan I'm trying to create service with exactly the same .NET Core class library, from default template in VS2015 Update 3. project.json and global.json are the same as yours. It doesn't work for me.

My Visual Studio WCF Connected Service is version 0.4.21213.0

I tried several services and I'm always getting:

Scaffolding Code ...
Error:Error: MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
An error occurred while bootstrapping svcutil. This usually happens when processing references. You might be able to work around this problem by not providing reference parameters, and manually removing any types redefined in the generated proxy code.

Failed to generate service reference.

I have no idea where to go next with this.

@lucky3 What version of the dotnet SDK do you have on your machine? If you have anything higher than 2.1, either uninstall it or go to C:\Program Files\dotnet\sdk and temporarily rename it.

@masaeedu 1.0.0-preview2-003133 and 1.0.4 do I need full .net like 4.6. or should it work without it?

@lucky3 Yeah, so 1.0.4 is the released SDK, and only works with csproj. Unfortunately this will only work once they release a "WCF Connected Service for VS2017" as zhenlan mentioned. In the meantime, you should rename the folders for all the SDK versions after 1.0.0-preview2-1-003177 temporarily.

@masaeedu renaming folder didn't help. Thank you for your help, I'm off for today.

@lucky3 We have released "WCF Connected Service for VS2017". Would you be able to use VS2017?

@hongdai currently not, but in a month or so... I have VS2017 on my computer, but our solution has many projects now, all .net core and on VS2015

@lucky3, just an idea, you can download and install WCF Connected Service for VS 2017, create a dummy .NET Core project, generate reference.cs using the tool and then copy the reference.cs back to your VS2015 project.

@zhenlan @hongdai @masaeedu thank you all for your help. I managed to get it work with VS2017 and copying reference to VS2015 project. Thanks again.

Was this page helpful?
0 / 5 - 0 ratings