I've written an Asp.Net Webforms app (aspx). The app is targeting DotNet 4.72. In the app, I'm using Tuples, so in order for the syntax to work, I've installed the nugget package Microsoft.CodeDom.Providers.DotNetCompilerPlatform version 2.0.0
the code that is not working looks like this:
public (Person, string, Int) Foo()
{
return (new Person(), "Hello", 42);
}
I was told to replace the nugget package with assembly reference, and I can't find a way to make it work. The steps I did are:
of the package to a folder in the project.
Result: I get build errors for the syntax:
error CS1031: Type expected
error CS1519: Invalid token '(' in class, struct, or interface member declaration
error CS1519: Invalid token ',' in class, struct, or interface member declaration
error CS1519: Invalid token ',' in class, struct, or interface member declaration
error CS1519: Invalid token ')' in class, struct, or interface member declaration
error CS1520: Method must have a return type
<system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" /> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /> </compilers> </system.codedom>
Then I got a compile error:
Could not find a part of the path 'C:\Users\myUserName\source\repos\WebSite1\WebSite1\bin\roslyn\csc.exe'.
Can I use this package without using NuGet package? If so, how do I do this?
Thanks in advance.
try copy dll files to bin directory or create a lib folder in project and reference it from there. Also make sure to right click dll file --> "properties --> copy to output directory --> copy always" is selected
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.