Uno: VS 19 keeps freezing when trying to add Uno Library project

Created on 4 Sep 2019  路  5Comments  路  Source: unoplatform/uno

Hi,

Current behavior

I'm trying to add an Uno Platform "Cross-Platform Library" to a solution containing an Uno's Cross-Platform App. Visual studio keeps freezing (default frosting/not-responding overlay) while trying to add such a project.

Expected behavior

That the project is added without a fuss :)

How to reproduce it (as minimally and precisely as possible)

  • Open VS
  • Create a new solution, choosing the project template "Cross-Platform App (Uno Platform)
  • Add a new project, choosing the project template "Cross-Platform Library (Uno Platform)

The latter project is created on disk, but (I assume) when it tries to change the sln file, it freezes.

Environment

Visual Studio

  • 2019 (version: 16.2.3 (enterprise))

Relevant plugins

  • Uno Platform Solution Templates v1.45.0.1862

Anything else we need to know?

I've tried:

  • Manually adding it to the sln file (via a texteditor), this causes vs to freez when it tries to load this project.
  • Creating a solution with another project type (eg a console app), then adding the Cross-Platform App, and finally adding the Uno Library.

Work around

Creating a new solution, adding the library first, then adding the app project.
(Adding other Uno-libraries afterwards work fine too btw...)

areexternal arevswin kinbug projeccore-tools

Most helpful comment

Thanks for the report!

This is an issue with the way the SDK Libraries are handled by Visual Studio, something that appears only when creating a library for the first time when the nuget cache is empty.

The workaround is the following:

  • Create a file named workaround.csproj with the following content:
<Project Sdk="MSBuild.Sdk.Extras/2.0.41">
  <PropertyGroup>
    <TargetFrameworks>netstandard2.0</TargetFrameworks>
  </PropertyGroup>  
</Project>
  • Using a Visual Studio Command Prompt, run the following command in the folder containing the above file:
msbuild /r

This will force the restore of the MSBuild.Sdk.Extras package.

  • Then try creating a library again.

Note that 2.0.41 may vary, depending on installed vsix version. See this file for the latest used version.

All 5 comments

Did you try running Visual Studio in Admin mode?

Just found a fix:

I compared the sln files of my original solution with a test-sln where I tried the workaround as I stated above.

The only difference was this line:
_(original solution)_
VisualStudioVersion = 16.0.29209.62

_(new solution)_
VisualStudioVersion = 16.0.29215.179

After changing this line in the original solution and reloading it, I was able to add the library project.

Thanks for the report!

This is an issue with the way the SDK Libraries are handled by Visual Studio, something that appears only when creating a library for the first time when the nuget cache is empty.

The workaround is the following:

  • Create a file named workaround.csproj with the following content:
<Project Sdk="MSBuild.Sdk.Extras/2.0.41">
  <PropertyGroup>
    <TargetFrameworks>netstandard2.0</TargetFrameworks>
  </PropertyGroup>  
</Project>
  • Using a Visual Studio Command Prompt, run the following command in the folder containing the above file:
msbuild /r

This will force the restore of the MSBuild.Sdk.Extras package.

  • Then try creating a library again.

Note that 2.0.41 may vary, depending on installed vsix version. See this file for the latest used version.

It could indeed be related to the cache, it seems to be working in all cases now. (I haven't cleared the nuget cache of course)

Hmm. Let's keep this one open. This definitely isn't the first-time experience we want folks to have with the Uno platform. If it happens to you again (or anyone else) please raise a Visual Studio for Windows feedback ticket via https://docs.microsoft.com/en-us/visualstudio/ide/feedback-options?view=vs-2019#report-a-problem

We're interested in your ideas for improving our products and documentation; here's how to send us feedback.
Was this page helpful?
0 / 5 - 0 ratings