GithubHelp home page GithubHelp logo

atifaziz / linqpadless Goto Github PK

View Code? Open in Web Editor NEW
281.0 9.0 23.0 1011 KB

LINQPad Queries without LINQPad

Home Page: https://www.nuget.org/packages/LinqPadless

License: Apache License 2.0

Batchfile 0.45% C# 98.75% Shell 0.38% Dockerfile 0.42%
linq linqpad csx scripting csharp

linqpadless's Introduction

LINQPadless

NuGet

LINQPadless compiles and runs LINQPad query files as stand-alone .NET Core applications without the need for LINQPad.

The compilation is cached and re-used until the source query file changes.

The LINQPad query file can be run on any platform where .NET Core is supported however it is the responsibility of the query author to ensure that the code and packages referenced are compatible with .NET Core and the execution platform.

Usage Examples

Compile and run a single LINQPad query file in the current directory:

lpless Foobar.linq

Compile but don't run:

lpless -x Foobar.linq

Force a re-compilation before running even if the LINQPad query file has not changed since the last run:

lpless -f Foobar.linq

For more information, see help:

lpless -h

Motivation

Why does LINQPadless exist?

LINQPad is an excellent alternative to Visual Studio when you want to script some code but don't want all the ceremony of a Visual Studio solution or project. You can use NuGet packages, get the same experience as IntelliSense, even debug through your code and all the while maintaining a single source file. What's there not to love about it? However, when you want to ship that code to someone or automate it, you are tied to LINQPad when that dependency is not necessary. That's where lpless comes in. It turns your LINQ Query file into a C# script or an executable that you can then run without LINQPad.

What's different from lprun?

lprun is a good solution when you need 100% compatibility and parity with LINQPad features at run-time. On the other hand, when all you are doing is using LINQPad as a lightweight IDE to script some task that doesn't need its bells and whistles then turning those queries into compiled executables enables them to be shipped and run without LINQPad.

Limitations

Requires .NET SDK 6+ for execution.

LINQPad Query files must be either C# Statements, Expression or Program.

LINQPad-specific methods like Dump and those on its Util class will cause compilation errors.

In loaded (#load) queries:

  • the Hijack hook method is not supported.
  • only an absolute path and a path relative to where the query is saved are supported in the #load directive.

linqpadless's People

Contributors

atifaziz avatar gusty avatar vcaraulean avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linqpadless's Issues

Support no-nesting via NONEST conditional

According to @albahari in a post to a thread in the LINQPad Forum:

Normally, anything types that you define end up as nested types, because LINQPad wraps everything that you enter into a class definition. You can tell LINQPad to extract the classes and define them as non-nested by adding the following to the beginning of your query:

#define NONEST

Add support for the same to this project.

Support #load directive

Consider adding support for #load directive that allows referencing other .linq files. Below are the relevant bits from the documentation of this feature:

Summary

In LINQPad 6, queries can reference other queries with the #load directive:

#load "SomeOtherQuery.linq"   // The #load directive must appear be at the top of the query

...

This works for all types of C# query (Expression, Statements and Program).

How does it work?

When you #load a query of type Expression or Statements, LINQPad lexically injects its source text into the target (or the target's Main method), so it behaves rather like you did a copy-and-paste. To avoid compilation errors, any namespaces that the #load-ed query imported via the Query Properties dialog, are also implicitly imported.

When you #load a query of type Program, LINQPad loads the query into a separate syntax tree. This allows for larger inclusions without hurting editor performance, and enables each loaded query to have it own using directives. This makes it suitable for creating mini-libraries.

Does the #load directive allow relative paths?

Yes. There are four ways to specify a path:

  • Absolute, e.g.,
    #load "c:\temp\query.linq"
    
  • Relative to the My Queries folder, e.g.,
    #load "azure.linq"
    #load "libs\azure.linq"
    
  • Relative to where the query is saved, e.g.,
    #load ".\azure.linq"
    #load "..\libs\azure.linq"
    
  • Relative to where the query is saved using 3 dots, e.g.,
    #load "...\azure.linq"
    #load "...\libs\azure.linq"
    

This tells LINQPad to keep looking up the directory hierarchy - right up to the root - until the file is found.

Can the loaded query reference assemblies and NuGet packages?

Yes - and these will be implicitly included in the main query.

Can a loaded query of type 'Program' still define a Main method?

Yes, and it gets ignored when loaded. So if you're writing a mini-library, it's a great place test your mini-library.

Are there any other limitations?

Right now, transitive references are not supported, so any nested #load directives are ignored (the workaround is to repeat them in the main query). This is to provide the best experience in terms of performance and tooling. Also, loaded queries can consume My Extensions, but not vice-versa (this is to avoid a circular reference).

Can loaded queries define extension methods?

Yes. It's a good idea to define your Extensions class as partial - this allows multiple #load-ed queries to share the same class name.


© LINQPad Pty Ltd 2007-2019 Written by Joseph Albahari

Calls requiring STA threads don't work

I have a script that need to access the clipboard. After compiling with lpless when I try to run executable it complains that to access clipboard it need STAthread. When I add this attribute to the linqpad script I get an error from compiler that it finds multiple entry points main and I need to specify main entry point. Any idea ?

SSL certificate error when downloading compiler with version 1.2

This is a follow-on issue reported in #49. It seems the patch applied in PR #50 was only a partial fix. It works as long as a LINQPad Query file contains a reference to at least one NuGet package.

Steps to Reproduce

  1. Install LINQPadless 1.2: nuget install LinqPadless -Version 1.2.0
  2. Create a LINQPad Query file called Test.linq with the following content (note that the blank line is significant):
    <Query Kind="Expression" />
    
    DateTime.Now
    
  3. Compile an executable: LinqPadless.1.2.0\tools\lpless.exe -t exe Test.linq

Expected Behaviour

Expected the compilation to succeed and generate an executable.

Actual Behaviour

A:\tmp\Test.linq
Packages directory: A:\tmp\packages
Packages target: .NETFramework,Version=v4.5.2
Installing C# compiler using NuGet:
    Downloading NuGet from https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe
The request was aborted: Could not create SSL/TLS secure channel.

Workaround

Reference at least one NuGet package. For example, changing Test.linq from above with the following content instead:

<Query Kind="Expression">
  <NuGetReference Version="3.0.0">Mannex</NuGetReference>
</Query>

DateTime.Now

produces an executable without an error when LinqPadless.1.2.0\tools\lpless.exe -t exe Test.linq is retried.


/cc @veremenko-y

support for database queries ?

does this tool support for linq to sql queries ??

so this tool is an amazing idea...
but i tried the following and it didn't work:

connect to local mssql and my c# program in linqpad looks like this:
var x = someTableName.Take(100);

Package references contains duplicates

An extract from csx:

#r "packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll"
#r "packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll"
#r "packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll"
#r "packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll"
#r "packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll"
#r "packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll"
#r "packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll"
#r "packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll"

It might look harmless. For traditional targets (like net461) where number of potential references is low there is little overhead. For netstandard targets reference lookup takes 10-20 seconds (running in console), ending up with a list of over 300 lines for the example from #13, lots of duplicates.

Some caching/tracking of "seen" items is probably welcome. Process will be faster and will contain no duplicates.

Support Main in a class, outside or under a namespace

It seems that #29 has more ramifications with respect to entry-point Main.

If Main is in a class in a namespace:

public static void Print(MethodBase method) =>
    Console.WriteLine($"{method.DeclaringType.FullName}::{method.Name}");

namespace MyApp1
{
    static class Program
    {
        static void Main(string[] args) =>
            Print(MethodBase.GetCurrentMethod());
    }
}

It gets called:

MyApp1.Program::Main

If there are two Main:

public static void Print(MethodBase method) =>
    Console.WriteLine($"{method.DeclaringType.FullName}::{method.Name}");

namespace MyApp1
{
    static class Program
    {
        static void Main(string[] args) =>
            Print(MethodBase.GetCurrentMethod());
    }
}
namespace MyApp2
{
    static class Program
    {
        static void Main(string[] args) =>
            Print(MethodBase.GetCurrentMethod());
    }
}

then the latter of the two is called:

MyApp2.Program::Main

If there is also a Main at root, however:

public static void Print(MethodBase method) =>
    Console.WriteLine($"{method.DeclaringType.FullName}::{method.Name}");

public static void Main(string[] args) =>
    Print(MethodBase.GetCurrentMethod());

namespace MyApp1
{
    static class Program
    {
        static void Main(string[] args) =>
            Print(MethodBase.GetCurrentMethod());
    }
}
namespace MyApp2
{
    static class Program
    {
        static void Main(string[] args) =>
            Print(MethodBase.GetCurrentMethod());
    }
}

then it is called instead:

UserQuery::Main

If there is a Main in a class without a namespace:

public static void Print(MethodBase method) =>
    Console.WriteLine($"{method.DeclaringType.FullName}::{method.Name}");

static class Program
{
    static void Main(string[] args) =>
        Print(MethodBase.GetCurrentMethod());
}

namespace MyApp1
{
    static class Program
    {
        static void Main(string[] args) =>
            Print(MethodBase.GetCurrentMethod());
    }
}
namespace MyApp2
{
    static class Program
    {
        static void Main(string[] args) =>
            Print(MethodBase.GetCurrentMethod());
    }
}

then it is called and trumps the other two:

UserQuery+Program::Main

Finally, a Main outside a class and a namespace:

public static void Print(MethodBase method) =>
    Console.WriteLine($"{method.DeclaringType.FullName}::{method.Name}");

public static void Main(string[] args) =>
    Print(MethodBase.GetCurrentMethod());

static class Program
{
    static void Main(string[] args) =>
        Print(MethodBase.GetCurrentMethod());
}

namespace MyApp1
{
    static class Program
    {
        static void Main(string[] args) =>
            Print(MethodBase.GetCurrentMethod());
    }
}
namespace MyApp2
{
    static class Program
    {
        static void Main(string[] args) =>
            Print(MethodBase.GetCurrentMethod());
    }
}

then it trumps all:

UserQuery+Program::Main

/cc @albahari

Support C# Program queries where Main is async

If Main is async then call to it needs to be awaited. For example:

async Task Main()
{
    await Task.Delay(TimeSpan.FromSeconds(1));
    Console.WriteLine(DateTime.Now);
}

should become:

async Task Main()
{
    await Task.Delay(TimeSpan.FromSeconds(1));
    Console.WriteLine(DateTime.Now);
}

await Main(); // added by LINQPadless

One option, albeit a little heavy-handed, would be to use Roslyn to parse and determine whether Main is async or not.


Forked from #2

Support LINQPad Program kind of queries

LINQPad Program queries could be supported easily by appending a call to Main at the end of the script such that:

void Main()
{
    Console.WriteLine(DateTime.Now);
}

gets compiled to the following C# script:

void Main()
{
    Console.WriteLine(DateTime.Now);
}

Main(); // added by LINQPadless

Non-assembly references

LINQPad allows non-assembly to be referenced and later used as an ordinary by getting its path via Util.GetFullPath. LINQPadless assumes that all references are assemblies and passed them on to C# Interactive that later chokes at run-time with a CS0009 error along the lines of:

test.csx(1,1): error CS0009: Metadata file 'A:\foobar.txt' could not be opened -- PE image doesn't contain managed metadata.

LINQPadless should fail to compile queries with such references.

LINQPad program queries with args don't compile

Suppose the following LINQPad program query:

<Query Kind="Program">
</Query>

void Main(string[] args)
{
}

// Define other methods and classes here

When run through lpless, the compiled program fails to build due to the following error:

error CS0111: Type 'UserQuery' already defines a member called 'Main' with the same parameter types

Documentation: Release

Is there a Release somewhere that can be downloaded. Also what does the .csx file look like and how are you running the .csx file?

No template for running query

Hi
I've tried to run:
.\lpless test.linq
And I got
No template for running query.
It wasn't clear from the documentation what this error meant, so I did some debugging and discovered that lpless searches for .csproj and .cs files. So I created a template project at .\.lpless\templates\template with a file Main.cs. But lpless just executed this template program. I found that it tries to match something with regex inside this method, but in my case it wasn't able to find any matches, so program remained unchanged.
What am I missing here?

System doesn't use LINQPad nuget manager specifing version

LINQPadLess version is 1.1

If LINQPad Nuget Manager specify Dapper 1.6 version (lowest .net version support 4.5.1)
image

but when i command lpless -t exe "path" system using nuget latest Dapper 2.0.35 version,and it doesn't support .net v4.5.2.

image


edited :

Even i edit .linq file and specifing the nuget version,it still not work.
image

LinqPadless 1.1 - SSL certificate error

I know you've decided to convert new version to .NET core ( :( ) but I still use LinqPad 5. Latest 1.1 version seems to fail due to the SSL issues. Is it possible to patch it and release an update?

This is what I was getting on the first run.

PS D:\...> lpless .\script.linq -t exe
D:\...\script.linq
  Packages directory: D:\...\packages
  Packages target: .NETFramework,Version=v4.5.2
  Installing C# compiler using NuGet:
    Downloading NuGet from https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe
The request was aborted: Could not create SSL/TLS secure channel.

After going over the source code, I managed to download csc manually and put it in the folder that lqless wants it to be, but that doesn't fully help, as you can see.

D:\...\script.linq
  Packages directory: D:\...\packages
  Packages target: .NETFramework,Version=v4.5.2
  Querying latest version of FakeLinqPad
An error occurred while retrieving package metadata for 'FakeLinqPad' from source 'https://api.nuget.org/v3/index.json'.

Dependency resolution should use lowest version

Create a LINQPad query called test.linq that references the MefBuild 0.1.0 package. MefBuild 0.1.0 has a dependency on Microsoft.Composition 1.0.27. In the directory where lpless installs packages, install also Microsoft.Composition 1.0.30. Then compile the query like this:

lpless.exe -v -t=exe test.linq

During compilation LINQPadless should report 6 resolved references:

Resolved references (6):
    packages\MefBuild.0.1.0\lib\portable-net45+win+wpa81+wp80\MefBuild.dll
    packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll
    packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll
    packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll
    packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll
    packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll

Note that the references point to Microsoft.Composition 1.0.30 rather than 1.0.27. It should be point to 1.0.27 if it's available to be consistent with the [lowest applicable version] policy of NuGet 3.x.

How LinqPadless V1.1 support netstandard 2.0?

e.g :
If system add ref of netstandard 2.0 project then command lpless.exe -t exe "path" will get below error msg :

error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

even i add LINQPad5\netstandard2 then system still not work
image
image

PS:
LinqPadless version is V1.1.

Support LINQPad Expression kind of queries

LINQPad Expression queries could be supported easily by wrapping them in parentheses and calling Dump or simply Console.WriteLine such that:

DateTime.Now

gets compiled to the following C# script:

Console.WriteLine(DateTime.Now);

Interactive session errors on references to system assemblies in C# script

What steps will reproduce the problem?

Create an empty LINQPad query file named Empty.linq then compile and run it as follows from a Windows Command Prompt (assuming current directory is same as where the query file is saved):

lpless  -t csx Empty.linq && Empty

The script should run without errors and emit a blank line. The compiled Empty.csx will look as follows:

#r "System.dll"
#r "Microsoft.CSharp.dll"
#r "System.Core.dll"
#r "System.Data.dll"
#r "System.Data.Entity.dll"
#r "System.Transactions.dll"
#r "System.Xml.dll"
#r "System.Xml.Linq.dll"
#r "System.Data.Linq.dll"
#r "System.Drawing.dll"
#r "System.Data.DataSetExtensions.dll"

using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Threading;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Data;
using System.Data.SqlClient;
using System.Data.Linq;
using System.Data.Linq.SqlClient;
using System.Transactions;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
System.Console.WriteLine(

);

Run a C# Interactive 2.0 (csi.exe) session and copy the content of the compiled Empty.csx above and paste it into the session.

What is the expected output? What do you see instead?

Expected the session to have the same behavior as running the script via the batch (Empty.cmd). Instead, the session emits errors for references to all system assemblies except System.dll:

Microsoft (R) Visual C# Interactive Compiler version 2.0.0.61501
Copyright (C) Microsoft Corporation. All rights reserved.

Type "#help" for more information.
> #r "System.dll"
> #r "Microsoft.CSharp.dll"
(1,1): error CS0006: Metadata file 'Microsoft.CSharp.dll' could not be found
> #r "System.Core.dll"
(1,1): error CS0006: Metadata file 'System.Core.dll' could not be found
> #r "System.Data.dll"
(1,1): error CS0006: Metadata file 'System.Data.dll' could not be found
> #r "System.Data.Entity.dll"
(1,1): error CS0006: Metadata file 'System.Data.Entity.dll' could not be found
> #r "System.Transactions.dll"
(1,1): error CS0006: Metadata file 'System.Transactions.dll' could not be found
> #r "System.Xml.dll"
(1,1): error CS0006: Metadata file 'System.Xml.dll' could not be found
> #r "System.Xml.Linq.dll"
(1,1): error CS0006: Metadata file 'System.Xml.Linq.dll' could not be found
> #r "System.Data.Linq.dll"
(1,1): error CS0006: Metadata file 'System.Data.Linq.dll' could not be found
> #r "System.Drawing.dll"
(1,1): error CS0006: Metadata file 'System.Drawing.dll' could not be found
> #r "System.Data.DataSetExtensions.dll"
(1,1): error CS0006: Metadata file 'System.Data.DataSetExtensions.dll' could not be found
>
> using System;
> using System.IO;
> using System.Text;
> using System.Text.RegularExpressions;
> using System.Diagnostics;
> using System.Threading;
> using System.Reflection;
> using System.Collections;
> using System.Collections.Generic;
> using System.Linq;
> using System.Linq.Expressions;
> using System.Data;
(1,14): error CS0234: The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)
> using System.Data.SqlClient;
(1,14): error CS0234: The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)
> using System.Data.Linq;
(1,14): error CS0234: The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)
> using System.Data.Linq.SqlClient;
(1,14): error CS0234: The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)
> using System.Transactions;
(1,14): error CS0234: The type or namespace name 'Transactions' does not exist in the namespace 'System' (are you missing an assembly reference?)
> using System.Xml;
> using System.Xml.Linq;
(1,18): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System.Xml' (are you missing an assembly reference?)
> using System.Xml.XPath;
> System.Console.WriteLine(
.
. );

VS Projects not loading

I downloaded the solution and opened it in VS 2019 on windows 10, Projects can't be loaded, get the following errors

LinqPadless-master\src\LinqPadless.csproj : error : The project file cannot be opened. The SDK resolver "Microsoft.DotNet.MSBuildSdkResolver" failed to run. Inconsistency in workload manifest 'microsoft.net.workload.mono.toolchain': missing dependency 'Microsoft.NET.Workload.Emscripten'

LinqPadless-master\tests\Tests.csproj : error : The project file cannot be opened. The SDK resolver "Microsoft.DotNet.MSBuildSdkResolver" failed to run. Inconsistency in workload manifest 'microsoft.net.workload.mono.toolchain': missing dependency 'Microsoft.NET.Workload.Emscripten'

LinqPadless-master.lpless\templates\template\ProgramTemplate.csproj : error : The project file cannot be opened. The SDK resolver "Microsoft.DotNet.MSBuildSdkResolver" failed to run. Inconsistency in workload manifest 'microsoft.net.workload.mono.toolchain': missing dependency 'Microsoft.NET.Workload.Emscripten'

Types without extension methods should remain nested UserQuery

The following LINQPad program query:

void Main()
{
    Print(NestedClass.StaticMethod      );
    Print(NestedStruct.StaticMethod     );
    Print(NestedStaticClass.StaticMethod);
    Print(default(object).Extension     );
    Print(Extensions.StaticMethod       );
}

static void Print(Action a) =>
    Console.WriteLine($"{a.Method.DeclaringType.FullName}::{a.Method.Name}");

struct NestedStruct
{
    public static void StaticMethod() {}
}

class NestedClass
{
    public static void StaticMethod() {}
}

static class NestedStaticClass
{
    public static void StaticMethod() {}
}

static class Extensions
{
    public static void StaticMethod() {}
    public static void Extension<T>(this T _) {}
}

displays the following in LINQPad (tested with version 6):

UserQuery+NestedClass::StaticMethod
UserQuery+NestedStruct::StaticMethod
UserQuery+NestedStaticClass::StaticMethod
Extensions::Extension
Extensions::StaticMethod

When run with LINQPadless, this produces:

NestedClass::StaticMethod
NestedStruct::StaticMethod
NestedStaticClass::StaticMethod
Extensions::Extension
Extensions::StaticMethod

Tested with version at 27c3fb6.

Support C# Statement queries using await when targeting executable

If a C# Statement LINQPad query uses the await keyword then the statement should be wrapped in a method declared with the async modifier that is then awaited. For example, the following should just work as it does in LINQPad:

Console.WriteLine(await Task.FromResult(DateTime.Now));

It works fine when compiled and executed as a C# script but fails with the following error when compiling to an executable using the --target exe option:

error CS4033: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.

Nuget packages with multiple assemblies are referencing only first .dll

If nuget packages referenced by linqpad script contains multiple assemblies, only first assembly is included in script reference section.

To reproduce:

  • Create new linqpad script
  • Add reference to Microsoft.Composition
  • lpless it

To observe:

  • Compilation output contains only 1 reference.
  • The lib folder of the package contains 5 dlls.
C:\Dev\Linqpad\Queries\linqpadless-issue-20.linq
  <Query Kind="Statements">
    <NuGetReference>Microsoft.Composition</NuGetReference>
  </Query>
  Packages referenced (1):
    Microsoft.Composition
  Packages directory: C:\Dev\Linqpad\Queries\packages
  Packages target: .NETFramework,Version=v4.6.2
  Querying latest version of Microsoft.Composition
    [INF]   GET https://api.nuget.org/v3/registration1-gz/microsoft.composition/index.json
    [INF]   GET https://api.nuget.org/v3/registration1-gz/microsoft.composition/index.json
    [INF]   OK https://api.nuget.org/v3/registration1-gz/microsoft.composition/index.json 651ms
    [INF]   OK https://api.nuget.org/v3/registration1-gz/microsoft.composition/index.json 651ms
    Using version 1.0.30
  Resolving references...
    Microsoft.Composition 1.0.30
  Resolved references (1):
    packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll

Cannot compile queries using nuget package Microsoft.CodeAnalysis 2.0.0

To repro, create a new query and add nuget package Microsoft.CodeAnalysis which is 2.0.0, add following code:

var workspace = new AdhocWorkspace();

Add missing namespace imports and ensure it works in Linqpad.

Now try to generate an exe with lpless, it will fail to compile since it cannot correctly add the assemblies from the nuget package.

No template for running query

Hello,

first try with 2.0 alpha. I just do a lpless "my file.linq" an get a "No template for running query"

What does it mean ?

thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.