-
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
Multitarget our msbuild task #24672
Multitarget our msbuild task #24672
Conversation
CC @agocke, @nguerrera, @dotnet/roslyn-infrastructure this is ready for review now |
@@ -40,7 +40,7 @@ public override bool Execute() | |||
|
|||
if (File.Exists(DestinationPath)) | |||
{ | |||
Guid source; | |||
var source = Guid.Empty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bonus points if someone can guess why I had to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because compiler can see private struct fields in new TFM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close ... it's because the definition of Guid
is different between netstandard1.3 and net46 according to the reference assemblies. In one case it's a struct without fields, in the other it's a struct with private fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(That's basically what I meant.)
<!-- N.B.: The backslashes below cannot be replaced with forward slashes. | ||
https://github.com/NuGet/Home/issues/3584 --> | ||
<file src="Dlls\MSBuildTask\netstandard1.3\publish\System.*.dll" target="tools" /> | ||
<file src="Dlls\MSBuildTask\netstandard1.3\publish\runtimes\**" target="tools\runtimes" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nguerrera, @agocke please make sure to verify the last two <file>
entries I deleted here is the right decision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look right. You still need to carry the dlls that are not in netcoreapp2. What's left in the netcoreapp 2 publish folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect pipes.accesscontrol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just including the output of build into the NuGet. Didn't think publish was necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, publish is necessary.
build/scripts/build.ps1
Outdated
@@ -249,8 +250,6 @@ function Build-ExtraSignArtifacts() { | |||
Run-MSBuild "..\Compilers\VisualBasic\vbc\vbc.csproj" "/p:TargetFramework=netcoreapp2.0 /t:PublishWithoutBuilding" | |||
Write-Host "Publishing VBCSCompiler" | |||
Run-MSBuild "..\Compilers\Server\VBCSCompiler\VBCSCompiler.csproj" "/p:TargetFramework=netcoreapp2.0 /t:PublishWithoutBuilding" | |||
Write-Host "Publishing MSBuildTask" | |||
Run-MSBuild "..\Compilers\Core\MSBuildTask\MSBuildTask.csproj" "/p:TargetFramework=netstandard1.3 /t:PublishWithoutBuilding" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect this to still be needed with netcoreapp2 tfm
<PackageReference Include="System.Diagnostics.Tools" Version="$(SystemDiagnosticsToolsVersion)" /> | ||
<PackageReference Include="System.IO.FileSystem" Version="$(SystemIOFileSystemVersion)" /> | ||
<PackageReference Include="System.IO.FileSystem.DriveInfo" Version="$(SystemIOFileSystemDriveInfoVersion)" /> | ||
<PackageReference Include="System.IO.Pipes" Version="$(SystemIOPipesVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System.IO.Pipes is in net46 and netcoreapp2.0 by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That appears to be the case.
<!-- N.B.: The backslashes below cannot be replaced with forward slashes. | ||
https://github.com/NuGet/Home/issues/3584 --> | ||
<file src="Dlls\MSBuildTask\netstandard1.3\publish\System.*.dll" target="tools" /> | ||
<file src="Dlls\MSBuildTask\netstandard1.3\publish\runtimes\**" target="tools\runtimes" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, publish is necessary.
@@ -472,7 +472,7 @@ private static bool CheckPipeConnectionOwnership(NamedPipeClientStream pipeStrea | |||
} | |||
} | |||
|
|||
#if NETSTANDARD1_3 | |||
#if NET46 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected far more of these #if's. Did you search to make sure there are no other mentions of NETSTANDARD1_3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same. There just weren't that many in the core compiler code base.
@agocke, @nguerrera added back the publish |
roslyn/src/Compilers/Core/MSBuildTask/AssemblyResolution.cs Lines 127 to 129 in c540e07
Is this still the right path? |
@nguerrera yes that's still the right path. I did a local build and verified the output path matches. C:\Users\jaredpar\code\roslyn\Binaries\Debug\Dlls\MSBuildTask\netcoreapp2.0\publish\runtimes\win\lib\netstandard1.3 |
Changes our task to multi-target between net46 and netcoreapp2.0. This matches how the rest of the SDK is deploying and makes for a smoother integration into CLI. context dotnet#24646
Now that we are multi-targeting there are a few references which are no longer necessary in the compiler package.
@agocke responded to your feedback. |
<!-- N.B.: The backslashes below cannot be replaced with forward slashes. | ||
https://github.com/NuGet/Home/issues/3584 --> | ||
<file src="Dlls\MSBuildTask\netstandard1.3\publish\System.*.dll" target="tools" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the logic behind the removal of the System assemblies? This is meant to cover the cases where we bring in dependencies (like S.R.M or S.C.I) that are newer than the versions available in the chosen CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is that they are simply no longer present. Now that we've properly multi-targetted this task the single and only DLL present after publish is the pipes DLL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that just luck? That is, the version of SRM/SCI that we reference is present in netcoreapp2.0. But if we upgrade to a newer one, shouldn't the new reference assembly be copied out? Otherwise I don't see how it could work properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it won't copy those if we change them. But I don't see that as a negative here. It forces us to be explicit about the dependencies we take here.
Note: the uses of System.* was IMHO equally as wrong. Not every facade begins with System. For example Microsoft.Win32. Same argument could be made for that as S.C.I.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the point of publish that determining the runtime dependencies via inspection can be intractable? It seems like if we go this route we should also have some way of failing the build if extra files do get generated, to make sure we don't drop them on the floor, only for the compiler to fail at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the loading logic for CoreCLR always prefers DLL loads next to the requesting assembly
This is true for applications. In this case we are a plugin to an application. Does the logic still hold there?
This is why we only have redirect logic for desktop and for the runtimes/ directory.
What is the recommendation for the desktop case then: blindly publish or not? If it's blindly publish then how do you reconcile that with the idea that we may have to probe for versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think the proper entry is here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are the entries I considered and why none of them work:
netcoreapp2.0/publish/**
: unnecessarily brings in PDB and XML filesnetcoreapp2.0/publish/System.*
: works for only part of the facades out there.netcoreapp2.0/publish/System.*
+microsoft.*
: this double writes our own binaries in the output folder
Take everything publish puts out and just trust that it's right.
The problem is that I'm looking at the output and it doesn't seem right. The publish directory contains items we don't want (at least that I can see).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, you've convinced me that (1) isn't really an option either. 😄 How should we handle the case that we upgrade assemblies and new stuff needs to be published? Manual review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the only thing we can do is manual update + prioritize bootstrapping out of our NuPkg files. That provides some automated checks that we have the right items there.
Changes our task to multi-target between net46 and netcoreapp2.0. This
matches how the rest of the SDK is deploying and makes for a smoother
integration into CLI.
context #24646
Ask Mode template not completed
Customer scenario
What does the customer do to get into this situation, and why do we think this
is common enough to address for this release. (Granted, sometimes this will be
obvious "Open project, VS crashes" but in general, I need to understand how
common a scenario is)
Bugs this fixes
(either VSO or GitHub links)
Workarounds, if any
Also, why we think they are insufficient for RC vs. RC2, RC3, or RTW
Risk
This is generally a measure our how central the affected code is to adjacent
scenarios and thus how likely your fix is to destabilize a broader area of code
Performance impact
(with a brief justification for that assessment (e.g. "Low perf impact because no extra allocations/no complexity changes" vs. "Low")
Is this a regression from a previous update?
Root cause analysis
How did we miss it? What tests are we adding to guard against it in the future?
How was the bug found?
(E.g. customer reported it vs. ad hoc testing)
Test documentation updated?
If this is a new non-compiler feature or a significant improvement to an existing feature, update https://github.com/dotnet/roslyn/wiki/Manual-Testing once you know which release it is targeting.