Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build library #411

Closed
LyndonGingerich opened this issue Jun 3, 2022 · 24 comments
Closed

Can't build library #411

LyndonGingerich opened this issue Jun 3, 2022 · 24 comments

Comments

@LyndonGingerich
Copy link
Contributor

I wish to learn more about the library and perhaps contribute to it, but I'm having significant difficulty getting started. I installed .NET Framework 4.5 and .NET 5.0, but I still get this stack of errors when I try to build the solution:

  Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': Stream does not support writing.
  Problem reading assembly 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': Stream does not support writing.)
  BuildFrameworkTcImports: no successful import of C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll
  Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': Stream does not support writing.
  Problem reading assembly 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': Stream does not support writing.)
  BuildFrameworkTcImports: no successful import of C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll
  Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\net45\FSharp.Core.dll': Stream does not support writing.
  Problem reading assembly 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\net45\FSharp.Core.dll': The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\net45\FSharp.Core.dll': Stream does not support writing.)
  BuildFrameworkTcImports: no successful import of C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\net45\FSharp.Core.dll
  NuGet.Build.Tasks.Pack.targets(221, 5): [NU5026] The file 'C:\Users\Lyndon.G\Documents\Repos\fsharp-hedgehog\src\Hedgehog\bin\Debug\net45\Hedgehog.dll' to be packed was not found on disk.

How can I resolve this?

Could we perchance upgrade Hedgehog to .NET 6 and .NET Framework 4.8 since .NET 5 and .NET Framework 4.5 have reach EOL?

@TysonMN
Copy link
Member

TysonMN commented Jun 3, 2022

Does this happen when you try to build via the command line or an IDE?

@LyndonGingerich
Copy link
Contributor Author

That was using an IDE. Here are the errors from building via CLI.

FSC : error FS0229: Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': Stream does not support writing. [C:\Users\Lyndon.G\Documents\Repos\fsharp-hedgehog\src\Hedgeh
og\Hedgehog.fsproj]
FSC : error FS3160: Problem reading assembly 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': The exception has been reported. This internal exception should now be caught at an error recov
ery point on the stack. Original message: Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': Stream does not support writing.) [C:\Users\Lyndon.G\Documents\Repos\fsh
arp-hedgehog\src\Hedgehog\Hedgehog.fsproj]
error FS0073 : internal error : BuildFrameworkTcImports: no successful import of C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll [C:\Users\Lyndon.G\Documents\Repos\fsharp-hedgehog\src\Hedgeho
g\Hedgehog.fsproj]
FSC : error FS0229: Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\net45\FSharp.Core.dll': Stream does not support writing. [C:\Users\Lyndon.G\Documents\Repos\fsharp-hedgehog\src\Hedgehog\Hedgeh
og.fsproj]
FSC : error FS3160: Problem reading assembly 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\net45\FSharp.Core.dll': The exception has been reported. This internal exception should now be caught at an error recovery point
 on the stack. Original message: Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\net45\FSharp.Core.dll': Stream does not support writing.) [C:\Users\Lyndon.G\Documents\Repos\fsharp-hedgehog\src\H
edgehog\Hedgehog.fsproj]
FSC : error FS0229: Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': Stream does not support writing. [C:\Users\Lyndon.G\Documents\Repos\fsharp-hedgehog\src\Hedgeh
og\Hedgehog.fsproj]
FSC : error FS3160: Problem reading assembly 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': The exception has been reported. This internal exception should now be caught at an error recov
ery point on the stack. Original message: Error opening binary file 'C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll': Stream does not support writing.) [C:\Users\Lyndon.G\Documents\Repos\fsh
arp-hedgehog\src\Hedgehog\Hedgehog.fsproj]
error FS0073 : internal error : BuildFrameworkTcImports: no successful import of C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\net45\FSharp.Core.dll [C:\Users\Lyndon.G\Documents\Repos\fsharp-hedgehog\src\Hedgehog\Hedgeho
g.fsproj]
error FS0073 : internal error : BuildFrameworkTcImports: no successful import of C:\Users\Lyndon.G\.nuget\packages\fsharp.core\4.1.17\lib\netstandard1.6\FSharp.Core.dll [C:\Users\Lyndon.G\Documents\Repos\fsharp-hedgehog\src\Hedgeho
g\Hedgehog.fsproj]

@moodmosaic
Copy link
Member

Thank you for reporting this. Out of curiosity, have you tried dotnet build from the command line?

@LyndonGingerich
Copy link
Contributor Author

Thank you for reporting this. Out of curiosity, have you tried dotnet build from the command line?

After Tyson suggested doing so, I ran the command and published the resulting errors in my previous post.

@moodmosaic
Copy link
Member

Unless @TysonMN has a better idea, this looks like something is corrupted in the .nuget cache? 😕

@TysonMN
Copy link
Member

TysonMN commented Jun 4, 2022

Sure. Trying deleting C:\Users\Lyndon.G\.nuget.

Also, can you figure out what command produces the output seen in this comment from dotnet and share with us your your output from that command?

If neither of those work, you could try <FSharpPreferNetFrameworkTools>false</FSharpPreferNetFrameworkTools> as suggested in that thread.

@LyndonGingerich
Copy link
Contributor Author

LyndonGingerich commented Jun 6, 2022

FSharpPreferNetFrameworkTools doesn't help, assuming it's supposed to go in the fsproj PropertyGroups.

Output of dotnet sdk check:

.NET SDKs:
Version      Status
----------------------------------------
3.1.419      Up to date.
5.0.302      .NET 5.0 is out of support.
5.0.408      .NET 5.0 is out of support.
6.0.101      Patch 6.0.105 is available.
6.0.300      Up to date.

.NET Runtimes:
Name                              Version      Status
--------------------------------------------------------------------------
Microsoft.NETCore.App             3.1.23       Patch 3.1.25 is available.
Microsoft.WindowsDesktop.App      3.1.23       Patch 3.1.25 is available.
Microsoft.AspNetCore.App          3.1.25       Up to date.
Microsoft.NETCore.App             3.1.25       Up to date.
Microsoft.WindowsDesktop.App      3.1.25       Up to date.
Microsoft.AspNetCore.App          5.0.17       .NET 5.0 is out of support.
Microsoft.NETCore.App             5.0.17       .NET 5.0 is out of support.
Microsoft.WindowsDesktop.App      5.0.17       .NET 5.0 is out of support.
Microsoft.AspNetCore.App          6.0.5        Up to date.
Microsoft.NETCore.App             6.0.5        Up to date.
Microsoft.WindowsDesktop.App      6.0.5        Up to date.

I'm on Windows 10 Pro 10.0.19044.

Anything else?

@TysonMN
Copy link
Member

TysonMN commented Jun 7, 2022

Could we perchance upgrade Hedgehog to .NET 6 and .NET Framework 4.8 since .NET 5 and .NET Framework 4.5 have reach EOL?

I wonder if you are referring to the version of the SDK, which is used to build the code, or the target version, which sets a lower bound on the version of the runtime.

I don't think we need to change the target version.

For the SDK version, sure. Please create a PR that updates this line and this line to the latest SDK. Then make any changes needed to get the code to build.

However, that just changes the SDK used by the build on GitHub, so I don't think that will help you.

@LyndonGingerich
Copy link
Contributor Author

LyndonGingerich commented Jun 7, 2022

@TysonMN Thank you. I understand better now. I'll do that once we get the build working on my machine.

@TysonMN
Copy link
Member

TysonMN commented Jun 9, 2022

How many computers can you test this on? For example, do you have a computer at home and a computer at work?

@LyndonGingerich
Copy link
Contributor Author

How many computers can you test this on? For example, do you have a computer at home and a computer at work?

I have a computer at home, but even if it built on my home computer, I would be using and contributing to this library only from my work computer.

@TysonMN
Copy link
Member

TysonMN commented Jun 9, 2022

Sure. I was just wondering if you could test this on another computer.

@TysonMN
Copy link
Member

TysonMN commented Jul 22, 2022

@LyndonGingerich, if you change the targets to newer versions (like in PR elmish/Elmish.WPF#488), can you build then?

@LyndonGingerich
Copy link
Contributor Author

Changing the targets worked after I also used NuGet to upgrade FSharp.Core. Many thanks!

@dharmaturtle
Copy link
Member

dharmaturtle commented Jul 22, 2022

FWIW I got the same error ("Error opening binary file... Stream does not support writing.") when using VS 2022. This was on a freshly formatted Win10 machine. The error went away when I went down to VS 2019. This is a known issue.

Edit: Oh hah, Tyson already linked that thread.

@TysonMN
Copy link
Member

TysonMN commented Jul 23, 2022

Resolved by PR #416

@TysonMN TysonMN closed this as completed Jul 23, 2022
@TysonMN
Copy link
Member

TysonMN commented Jul 23, 2022

First included in version 0.13.0

@TysonMN
Copy link
Member

TysonMN commented Jul 24, 2022

@LyndonGingerich, if you change the targets to newer versions (like in PR elmish/Elmish.WPF#488), can you build then?

I know I suggested to copy this PR from Elmish.WPF. However, what is the advantage of multi-targeting for this library?

@LyndonGingerich
Copy link
Contributor Author

LyndonGingerich commented Jul 25, 2022

What is the advantage of multi-targeting for this library?

Not knowing which targets had active users, I simply upgraded each target to a version under support if possible and removed it otherwise.

@TysonMN
Copy link
Member

TysonMN commented Jul 26, 2022

I am not talking about users.

Projects targeting net48 or net6.0 can depend on projects that target netstandard2.0 (.NET Standard documentation).

A project targeting any version of .NET (Core) can depend on a project that targets netstandard2.0.

I think you were too aggressive when you replaced net45 with net48. The most conservative change would be to replace with net462, the oldest version of .NET Framework that had not reached end of life (except for 3.5). But even a project targeting net462 can depends on a project that targets netstandard2.0.

In conclusion, we can just target netstandard2.0 while maintaining the current applicability.

@TysonMN
Copy link
Member

TysonMN commented Jul 26, 2022

Can you make a PR with that simplification?

@TysonMN
Copy link
Member

TysonMN commented Jul 26, 2022

I think we could target .NET Standard 1.6 (since we were before), but this is not recommended.

We don't recommend targeting .NET Standard 1.x, as you'd limit the available feature set for a minimal increase in reach.
[...]
Use netstandard2.0 to share code between .NET Framework and all other implementations of .NET.

https://docs.microsoft.com/en-us/dotnet/standard/net-standard

@LyndonGingerich
Copy link
Contributor Author

@TysonMN If I understand correctly, you would like all projects to target netstandard2.0 (not netstandard2.1) alone, including those currently targeting only net6.0. Is this correct?

@TysonMN
Copy link
Member

TysonMN commented Jul 26, 2022

Only the Hedgehog project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants