I have just went through one of my projects and used a bunch of the new c# 6 features like the null propagation operator handler?.Invoke(null, e)
, which builds in Visual Studio. However, when I run my script to publish out the NuGet packages, I get compilation errors saying:
EventName.cs(14,66): error CS1056: Unexpected character '$'
EventName.cs(69,68): error CS1519: Invalid token '=' in class, struct, or interface member declaration
EventName.cs(69,74): error CS1520: Method must have a return type
It would appear NuGet is using an older version of the compiler, but I was wondering if anyone knew a work around or configuration that could be set to resolve the issue.
Setting names are case-insensitive, and values can use environment variables. Add a nuget. config file in the root of your project repository.
Put simply, a NuGet package is a single ZIP file with the . nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number.
nuget/NuGet folder. These other tools look for the user config file under the ~/. config/NuGet folder: Mono.
Step 1 - Select Tools > NuGet Package Manager > Package Manager Console. It will open a console in the bottom of the window. Step 2 - Select your project and execute the command to install the package. If it's a valid command, then the package will be installed to your project.
Looks like you have also found this bug in the Nuget which is still not resolved: https://github.com/NuGet/Home/issues/1107
You can use the following workaround:
Modify the script to build your project using correct version of MSBuild - just call MSBuild.exe
yourself, supply the path to the csproj or sln file and build your project in a correct configuration yourself.
Create a nuspec file that describes your package (https://docs.nuget.org/create/nuspec-reference). You can use the Nuget Package Explorer app. Use DLLs produced in step 1.
Use nuget pack mypackage.nuspec
to build the package.
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