iqsharp icon indicating copy to clipboard operation
iqsharp copied to clipboard

Use MSBuild logic to compile .csproj references

Open rmshaffer opened this issue 5 years ago • 1 comments

Is your feature request related to a problem? Please describe. As of https://github.com/microsoft/iqsharp/pull/262, IQ# supports adding references to .csproj project files that reference Microsoft.Quantum.Sdk. However, the implementation of this feature simply parses the .csproj for ProjectReference and PackageReference elements and does not actually use MSBuild logic to build the project. This means that any custom build logic (for example, custom QsharpCompile specifications) would not be honored, and therefore the project may not compile as intended.

Describe the solution you'd like IQ# should use MSBuild logic so that project assemblies are built identically to the way dotnet build would build them.

Describe alternatives you've considered One alternative would be for IQ# to simply call dotnet build out-of-process and load the resulting assembly. But since IQ# is delivered via a conda package, this would require the .NET CLI to also be included as a dependency of that conda package. The .NET CLI is not currently available as a conda package, so that may result in a bit of additional work. It seems preferable to use the MSBuild logic directly inside the IQ# process.

rmshaffer avatar Aug 17 '20 17:08 rmshaffer

Wanted to add here, from discussion in #285, that it would also be desirable to support arbitrary project references (e.g. C# projects), not only projects based on Microsoft.Quantum.Sdk. For example, custom magic commands or display encoders can currently only be loaded as package references, but in the context of a large project it may certainly be desirable to load those via project references as well.

rmshaffer avatar Aug 20 '20 12:08 rmshaffer