I'm setting up a Redis cache server in vb.net, so I started implementing the Redis class in my source code so I could use the class methods later.
I currently have this error: "BC30037: invalid caracter" and I can't resolve it. The error comes from the character "$" in front of my string allowing to normally make string interpolation. Here it doesn't work and on the contrary, this character is considered to be invalid (the compilator doesn't understand that it's an interpolation string and therefore returns an error because).
I found someone who solved the same problem in another topic but he used Team Foundation Server and was working on a Visual Studio project : tfs build server - string interpolation $ Character is not valid
I'm working with Visual Studio 2019 and ASP.NET 4.7.2 but I have no project (my code is as it is in visual studio but it's not in a project).
I would like to know how to solve this problem with my current configuration?
Public Function GetCommand() As String Implements IRedisCommand.GetCommand
Return $"APPEND {Key} {Value}" //$ is the problem here
End Function
For anyone else wanting to use the latest features in vb.net like string interpolation, here are the steps I had to take to resolve the BC30037 error:
I should note that the error for me only appeared when running the code locally. When published to a server 2012 running iis 7.5+, things worked just fine.
First, make sure your app is using .Net Framework 4.5.1
or higher.
Next, open the package-manager and run
PM> Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
This will setup your web.config to target the latest compiler. I believe this is why it doesn't work locally, but worked on the server.
Finally, run
PM> update-package -reinstall
This makes sure any previously installed libraries are updated for 4.5.1+
Recompile and run your local debug to validate! Hope that helps someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With