botframework-components icon indicating copy to clipboard operation
botframework-components copied to clipboard

Command failed: dotnet build Empty.csproj

Open dawwa opened this issue 3 years ago • 10 comments

Version

Composer 2.0 Windows

To Reproduce

Steps to reproduce the behavior: Simply Create a New Bot, it behaves as below.

image

image

dawwa avatar May 21 '21 01:05 dawwa

@cwhitten Could you please route it to anyone who can help the customer?

ninggao avatar May 21 '21 18:05 ninggao

Related microsoft/BotFramework-Composer#7876

@dawwa Could you open Windows command line.Navigate to the bot folder for ex if its C/User/Documents/Empty_1/ navigate to the folder cd C/User/Documents/Empty_1/Empty_1 and run the command dotnet build Empty.csproj. Do you get command failed there as well.

@benbrown @pavolum

srinaath avatar May 21 '21 19:05 srinaath

@dawwa what version of dotnet do you have installed on your system? Does the dotnet command line tool work as expected?

benbrown avatar May 21 '21 19:05 benbrown

@dawwa If this is still giving you a problem, can you try this:

  • Create a new bot from scratch in 2.0
  • Assuming this works as expected, attempt to open your old bot again
  • Go through the migration process

Let me know if this resolves the problem!

benbrown avatar May 24 '21 16:05 benbrown

what I did is acting quick to make a copy of the entire project folder, before the creation process fails and initiates its post-failure-cleanup; Then I open visual studio, build the project once manually; after this, the Composer would be able to load the project properly and function well.

I accidently found this workaround, but not sure why this helps, but it unblocks me, it happens pretty frequent, and this trick works every time.

dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.203
 Commit:    383637d63f

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.203\

Host (useful for support):
  Version: 5.0.6
  Commit:  478b2f8c0e

.NET SDKs installed:
  2.1.816 [C:\Program Files\dotnet\sdk]
  2.2.110 [C:\Program Files\dotnet\sdk]
  3.0.103 [C:\Program Files\dotnet\sdk]
  3.1.115 [C:\Program Files\dotnet\sdk]
  5.0.104 [C:\Program Files\dotnet\sdk]
  5.0.203 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

dawwa avatar May 25 '21 06:05 dawwa

@dawwa Thank you for the additional information. Does this continue to happen after the first time? Are you now able to create new projects?

benbrown avatar May 25 '21 15:05 benbrown

@benbrown, this does not seem repro for me anymore, but I do remember this repeats, not sure in what condition, but I could not repro it any more on my machine. It feels like the composer assumes and expects something but not exist yet when first time run, and after the project gets built once externally outside of the composer.

It would be good to know if any logs somewhere from the Composer, so that I could report back with logs for your reference when it happens next time.

dawwa avatar May 26 '21 08:05 dawwa

@dawwa I'm glad to hear the problem is not continuing. Seems like the root cause may be related to the initial dependency installation process. I'll continue to investigate.

benbrown avatar May 26 '21 15:05 benbrown

I'm also getting the same error. My gut feel is it's related to the default .net SDK version. I found that preferred .Net Bot Framework SDK version is 3.1. But latest version is 5.1

I had similar issue with Visual Studio as well (Nuget package restore error). The sample projects did not Build and run by default. When I ran the dotnet build from command line it worked and Nuget package were restored. And then project started working in VSCode, CommandLine as well as Visual Studio.

Is there a way or command to set the default .Net SDK?

piyush-ramavat avatar Jun 04 '21 07:06 piyush-ramavat

I had this issue and fixed it by removing the offline packages source in the NuGet.Config file. You can find the file at C:\Users\YourUserNameHere\AppData\Roaming\NuGet\NuGet.Config

Open this file, and remove packageSource that refers to a (local) folder. Probably it's just the "Microsoft Visual Studio Offline Packages".

<packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" /> -->
</packageSources>

Remove of comment out the reference so you end up with something like this.

<packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>

Just make sure there is no source that goes to a folder in the NuGet.Config file.

Hedva avatar Mar 31 '23 12:03 Hedva