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

Compile issue in VS 2022 #223

Closed
Arash-Sabet opened this issue Jan 9, 2024 · 4 comments · Fixed by #224
Closed

Compile issue in VS 2022 #223

Arash-Sabet opened this issue Jan 9, 2024 · 4 comments · Fixed by #224
Labels
bug Something isn't working

Comments

@Arash-Sabet
Copy link
Contributor

Arash-Sabet commented Jan 9, 2024

Describe the bug
VS 2022 generates the following compile error when compiling the solution:

Severity Code Description Project File Line Suppression State
Error MSB4018 The "StaticWebAssetsGeneratePackagePropsFile" task failed unexpectedly.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\arash\source\repos\xunit-dependency-injection\examples\Xunit.Microsoft.DependencyInjection.ExampleTests.CalculationService\obj\Debug\net8.0\staticwebassets\msbuild.buildMultiTargeting.Xunit.Microsoft.DependencyInjection.ExampleTests.CalculationService.props'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.File.InternalWriteAllBytes(String path, Byte[] bytes, Boolean checkHost)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAssetsGeneratePackagePropsFile.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() Xunit.Microsoft.DependencyInjection.ExampleTests.CalculationService C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Pack.targets 150

To Reproduce
Per above

Expected behavior
Such an error should not happen.

Screenshots
If applicable, add screenshots to help explain your problem.

dotnet core version info:
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.8d38d0cc

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.100\

.NET workloads installed:
Workload version: 8.0.100-manifests.8d38d0cc
There are no installed workloads to display.

Host:
Version: 8.0.0
Architecture: x64
Commit: 5535e31a71

.NET SDKs installed:
8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

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

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

Operation system:

  1. Windows 11

Additional context

@Arash-Sabet Arash-Sabet added the bug Something isn't working label Jan 9, 2024
@Arash-Sabet
Copy link
Contributor Author

Arash-Sabet commented Jan 9, 2024

Hey @ChrisDoernen Do you happen to know why this issue starts happening? Have you experienced it? Did you probably forget to include a file?

@Arash-Sabet
Copy link
Contributor Author

@ChrisDoernen
I had to repair my VS 2022 instance per this post but that did not work out. I also tried the main branch's source code on another machine and it exhibited the same problem. Since this issue may happen to others, I have to take your sample project out of the solution to experience a smooth compile.

@ChrisDoernen
Copy link
Contributor

Oh ok, that's not good.
This did not happen to me. I currently don't have access to my other Machine for more infos, the basic environment is:

  • Windows 10
  • .NET 8 SDK 8.0.100 (only version installed)
  • JetBrains Rider

Nevertheless, dotnet build should work on any machine, especially when we are both on Windows with the same .NET version. Really strange. I'll check the branch again tomorrow.

@Arash-Sabet
Copy link
Contributor Author

@ChrisDoernen The main branch no longer this problem as I had to take out the merged PR code containing your example. docent build works fine but some people like me may struggle if they use VS 2022. Not sure what the root cause is but bottom line we want a smooth and less complicated coding environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants