-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the command-line compilers able to generate reference assemblies #2184
Comments
Excellent I'm happy to see this making some forward progress, the proposal seems reasonable to me. We haven't put our reference assembly building stuff in our github project yet but once this is available we will have a closer look at trying to use it. |
Nice. |
👍 This would be a big help for cleaning up the corefx reference assembly processes. I believe it would cover all of our scenarios. |
👍 This is becoming more important now that reference assemblies are supported by NuGet. |
👍 This would be awesome. |
@gafter Any ideas on the timeline for this feature? |
@weshaggard Aiming for VS2015 update 2, but who knows. We accept pull requests. |
This mini-spec has been expanded into a more detailed design doc (https://github.com/dotnet/roslyn/pull/18501/files). I'll close this issue. The remaining refinement work items are tracked by #17612 |
Provides an item, `ReferencePathWithInterfaceOnlyAssemblies`, that consists of the reference (interface-only) versions of assemblies where available, allowing a consuming task to be incrementally up-to-date after implementation-only changes have been made to a reference. When `%(ReferenceAssembly)` metadata is unavailable for a given reference, the new item contains the implementation assembly directly. Additionally creates a new output item for the current project's reference assembly by default when `$(Deterministic)` is `true`. If this is created, it is copied to the output directory using the new `CopyRefAssembly` task, which copies only if the ref assembly is different from the current file. If present, the ref asm is passed to the project's consumes in metadata. See #1986, dotnet/roslyn#2184.
Provides an item, `ReferencePathWithInterfaceOnlyAssemblies`, that consists of the reference (interface-only) versions of assemblies where available, allowing a consuming task to be incrementally up-to-date after implementation-only changes have been made to a reference. When `%(ReferenceAssembly)` metadata is unavailable for a given reference, the new item contains the implementation assembly directly. Additionally creates a new output item for the current project's reference assembly by default when `$(Deterministic)` is `true`. If this is created, it is copied to the output directory using the new `CopyRefAssembly` task, which copies only if the ref assembly is different from the current file. If present, the ref asm is passed to the project's consumes in metadata. See #1986, dotnet/roslyn#2184.
Provides an item, `ReferencePathWithInterfaceOnlyAssemblies`, that consists of the reference (interface-only) versions of assemblies where available, allowing a consuming task to be incrementally up-to-date after implementation-only changes have been made to a reference. When `%(ReferenceAssembly)` metadata is unavailable for a given reference, the new item contains the implementation assembly directly. Additionally creates a new output item for the current project's reference assembly when `$(ProduceReferenceAssembly)` is true. If this is created, it is copied to the output directory using the new `CopyRefAssembly` task, which copies only if the ref assembly is different from the current file. If present, the ref asm is passed to the project's consumes in metadata. Introduce $(CompileUsingReferenceAssemblies), which can avoid passing reference assemblies to the compiler when set to false. This is not expected to be commonly used. IDE fast up-to-date checks need to be able to compare timestamps on _both_ the reference assembly (to see if a recompile is needed) and the implementation assembly (because it needs to be copied to an output location). Provide OriginalPathmetadata on the adjusted references that points back to the implementation assembly if a ref assembly was found. When a project both uses and produces reference assemblies, its primary output assembly might be up to date while (transitive) references need to be copied to its output directory. This case fooled the Visual Studio Fast Up-To-Date check, because the transitive dependencies aren't listed as project inputs (because design-time builds disable RAR's FindDependencies for performance reasons). To account for this, introduce a new file that is updated whenever _CopyFilesMarkedCopyLocal does actual work, pass it along as part of the project's output, and consider it a project input for the FUTD check. See #1986, dotnet/roslyn#2184.
I have a fix to not emit resources into ref assemblies produced with |
I don't think this feature is being used by corefx (yet?) but IIRC, there are designer or toolbox features that rely on certain resources in reference assemblies. @weshaggard might recall for sure. It seems to me that if one calls /refonly and passes resources, they should be retained. The caller could simply not pass them if they're not wanted. This is unlike /refout where not passing them would compromise the main assembly. Also are we not concerned about the breaking change here in both refout and refonly case? |
We propose the following two new command-line options for the Roslyn compilers.
If any resources are included on the command line, those resources are included in the generated reference assembly only if
/refonly
appeared on the command line.The generated reference assembly includes any assembly-internal symbols that appeared in the source. Private members are excluded from the reference assembly except when required to preserve semantics (i.e. certain situations involving structs). It is an open question whether there should be an additional option to exclude internal members.
A reference assembly produced by the compiler would always be marked with the bit that tells the CLR not to load it at runtime.
These new command-line options address our requirements as follows:
The sources for the contract assembly would be written, either by hand or using separate tools, to exclude declarations of private, internal, or unsupported symbols, and excluding method bodies. Under this proposal the compiler would be invoked using
/refout=<file> /refonly
on hand-build contract sources without any resources specified on the command-line to produce this artifact./refout=<file> /refonly
options instead of the /out option./refout=<file>
option.The text was updated successfully, but these errors were encountered: