dotnet / dotnet/project-system
Cannot add audio resource to .NET Standard 2.0 project
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
@chakrabar commented on [Sat Jan 13 2018](https://github.com/dotnet/core/issues/1217)
I have an existing `.NET Framework` codebase, and I'm trying to port that to `.NET Core`. As part of the process, I'm converting my class libraries to `.NET Standard 2.0` project.
In one of my projects, I'm using bunch of files as project resource (`Resource.resx`). When I add other files as `Files`, such as Excel.xlsx files, they work fine and I can simply use them in my code as
byte[] fileData = Resources.MyFileName;
But when I'm trying to add some `Audio` (.wav) file I'm facing the problem
1. it is always getting added as `Other`.
2. The project fails to compile with following error (see image below)
> System.IO.MemoryStream, netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 cannot be located.
This whole process works fine when I'm using in `.NET Framework 4.6.1` project.
Note: I've also tried installing `System.IO v4.3.0` NuGet package.
### Further technical details
Class Library: .NET Standard 2.0
Operating system: Windows 8.1 x64
IDE: Visual Studio Community 2017 v15.5.2

---
@Petermarcu commented on [Sun Jan 14 2018](https://github.com/dotnet/core/issues/1217#issuecomment-357540302)
@livarcocc @davkean Do you think this is SDK or project system?
---
@livarcocc commented on [Tue Jan 16 2018](https://github.com/dotnet/core/issues/1217#issuecomment-358041300)
@chakrabar Does a build of this project work from the command line?
---
@chakrabar commented on [Wed Jan 17 2018](https://github.com/dotnet/core/issues/1217#issuecomment-358340441)
@livarcocc It worked! I built the project from cli and the project built fine without any errors!
dotnet build MyProject.csproj --no-incremental -f netstandard2.0 -r win81-x64 -v m
And strange enough, once it was built using cli, the resource appeared properly in VS as `audio` resource and it built in VS as well!! I could refer that resource in code like the other resources.

---
@livarcocc commented on [Wed Jan 17 2018](https://github.com/dotnet/core/issues/1217#issuecomment-358385460)
@chakrabar glad it worked.
@Pilchie can you take a look? Seems to be failing only when trying to add it through VS.
---
@Petermarcu commented on [Wed Jan 17 2018](https://github.com/dotnet/core/issues/1217#issuecomment-358407030)
Which repo is the best to track this in?
---
@Pilchie commented on [Wed Jan 17 2018](https://github.com/dotnet/core/issues/1217#issuecomment-358452414)
dotnet/project-system.
---
@chakrabar commented on [Mon Feb 05 2018](https://github.com/dotnet/core/issues/1217#issuecomment-363132503)
@Petermarcu is this being tracked anywhere?
Contributor guide
Assessment
This issue has not been assessed yet.