diff --git a/src/Simulation/CsharpGeneration/RewriteStep.fs b/src/Simulation/CsharpGeneration/RewriteStep.fs index 4fc53dd609c..43c6db50fba 100644 --- a/src/Simulation/CsharpGeneration/RewriteStep.fs +++ b/src/Simulation/CsharpGeneration/RewriteStep.fs @@ -53,12 +53,22 @@ type Emitter() = let context = CodegenContext.Create (compilation, step.AssemblyConstants) let allSources = GetSourceFiles.Apply compilation.Namespaces - for source in allSources |> Seq.filter context.GenerateCodeForSource do - let content = SimulationCode.generate source context - CompilationLoader.GeneratedFile(source, dir, ".g.cs", content) |> ignore - for source in allSources |> Seq.filter (not << context.GenerateCodeForSource) do - let content = SimulationCode.loadedViaTestNames source context - if content <> null then CompilationLoader.GeneratedFile(source, dir, ".dll.g.cs", content) |> ignore + let isExe = + match context.assemblyConstants.TryGetValue AssemblyConstants.QsharpOutputType with + | true, outputType -> outputType = AssemblyConstants.QsharpExe + | _ -> false + + if isExe then + for source in allSources do + let content = SimulationCode.generate source context + CompilationLoader.GeneratedFile(source, dir, ".g.cs", content) |> ignore + else + for source in allSources |> Seq.filter context.GenerateCodeForSource do + let content = SimulationCode.generate source context + CompilationLoader.GeneratedFile(source, dir, ".g.cs", content) |> ignore + for source in allSources |> Seq.filter (not << context.GenerateCodeForSource) do + let content = SimulationCode.loadedViaTestNames source context + if content <> null then CompilationLoader.GeneratedFile(source, dir, ".dll.g.cs", content) |> ignore if not compilation.EntryPoints.IsEmpty then let callable = context.allCallables.[Seq.exactlyOne compilation.EntryPoints] diff --git a/src/Simulation/QsharpCore/Diagnostics/Dump.qs b/src/Simulation/QsharpCore/Diagnostics/Dump.qs index 6484a93cc35..316b3305290 100644 --- a/src/Simulation/QsharpCore/Diagnostics/Dump.qs +++ b/src/Simulation/QsharpCore/Diagnostics/Dump.qs @@ -26,6 +26,7 @@ namespace Microsoft.Quantum.Diagnostics { /// one-dimensional array of complex numbers, in which each element represents /// the amplitudes of the probability of measuring the corresponding state. function DumpMachine<'T> (location : 'T) : Unit { + body intrinsic; } /// # Summary @@ -56,6 +57,7 @@ namespace Microsoft.Quantum.Diagnostics { /// If the given qubits are entangled with some other qubit and their /// state can't be separated, it just reports that the qubits are entangled. function DumpRegister<'T> (location : 'T, qubits : Qubit[]) : Unit { + body intrinsic; } } diff --git a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj index e0ac7e6c07c..8550cbd4749 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj index 4a49760ae8e..74789d73958 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj @@ -1,4 +1,4 @@ - + Library diff --git a/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj b/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj index f98e674ef78..d48246c07b1 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 false diff --git a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj index 57ad5f9a890..da7d54671c5 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj @@ -1,4 +1,4 @@ - + Library diff --git a/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj index a6397927088..1417e1242b7 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj @@ -1,4 +1,4 @@ - + Exe