question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Microsoft.VisualStudio.JavaScript.Sdk` is not working outside of Windows (but it can)

See original GitHub issue

Describe the bug

JavaScript MSBuild projects (.esproj) are not working outside Windows. But it is possible to get it to work with a workaround (see below)

To Reproduce

  1. On Windows, follow the tutorial to create a new ASP.NET Core + RactJS (Preview) solution, as it seems that creating of such a project is impossible outside VS.
  2. Copy the resulting solution on the MacOS/Linux environment.
  3. Run dotnet build inside the solution folder.

Expected behavior

Build succeeded.

Actual behavior

/usr/local/share/dotnet/sdk/8.0.100-preview.4.23260.5/Microsoft.Common.CurrentVersion.targets(1229,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/Users/seclerp/Downloads/AspNetCoreReactPreview/reactapp/reactapp.esproj]
    0 Warning(s)
    1 Error(s)

Workaround

Adding such a property group to a .esproj file:

<PropertyGroup Condition=" '$(OS)' == 'Unix' " >
    <FrameworkPathOverride>/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/mscorlib.dll</FrameworkPathOverride>
</PropertyGroup>

Fixes the issue.

Further technical details

The issue reproduces on both 8.0 preview and 7.0 SDK.

Seems like the root cause of the issue is using the default full-framework toolset for .esproj projects which is absolutely fine on Windows environment for .NET SDK but not the case for Mac OS and Linux.

I’m interested in making PR to fix that but can’t find the sources (does JavaScript.Sdk is even open-sourced?)

Thanks.

.NET info

➜ dotnet --info
.NET SDK:
 Version:   8.0.100-preview.4.23260.5
 Commit:    2268e7b15c

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  13.3
 OS Platform: Darwin
 RID:         osx.13-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.100-preview.4.23260.5/

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.0-preview.4.23259.5
  Architecture: arm64
  Commit:       84a3d0e37e

.NET SDKs installed:
  7.0.203 [/usr/local/share/dotnet/sdk]
  8.0.100-preview.4.23260.5 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-preview.4.23260.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-preview.4.23259.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  x64   [/usr/local/share/dotnet/x64]
    registered at [/etc/dotnet/install_location_x64]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Issue Analytics

  • State:closed
  • Created 4 months ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
jojcommented, Aug 9, 2023

This was moved to internal tracking (the JavaScript SDK is tracked there). We’re testing at the moment on both Linux and Mac and will probably have support in a preview of VS soon.

3reactions
jojcommented, May 29, 2023

I’ll move this to our internal tracking systems. It aligns with the revamp we’re doing now on dotnet and esproj, so we can add it to that. Thanks! J

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript and TypeScript in Visual Studio
Learn how Visual Studio provides rich support for JavaScript development, both using JavaScript directly, and also using the TypeScript ...
Read more >
The SDK 'Microsoft.NET.Sdk' specified could not be found. ...
The SDK 'Microsoft.NET.Sdk' specified could not be found. in Visual Studio Community 2022 version 17.5 · Right-click your project > Unload ...
Read more >
Troubleshoot Visual Studio installation and upgrade issues
This troubleshooting guide includes step-by-step instructions to resolve common issues with Visual Studio installation and upgrade.
Read more >
Exploring JavaScript and TypeScript Development in ...
We will focus mainly on the productivity improvements including the JavaScript and TypeScript project type, project templates, code editing, ...
Read more >
Installing the Visual Studio SDK
Learn about the options to install the Visual Studio Software Development Kit, including during Visual Studio installation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found