GVFS.Upgrader: migrate to netcore project #1059
Conversation
9f45673 to
25abf19
Compare
b4c80ad to
87c1f87
Compare
|
|
||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> | ||
| <RuntimeIdentifiers>osx-x64</RuntimeIdentifiers> |
There was a problem hiding this comment.
This RuntimeIdentifier probably does not belong in this common PropertyGroup that is included for both net461 and netcoreapp2.1.
There was a problem hiding this comment.
You can set the identifier conditionally on the TF.
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
<RuntimeIdentifier Condition="'$(TargetFramework)'=='net461'">win-x64</RuntimeIdentifier>Here when building the TF as net461 you're also forcing the RID to be win-x64.
For TF netcoreapp2.1 you'll need to specify which OS you're targeting still.
There was a problem hiding this comment.
What @mjcheetham proposed seems like it should work, but I bet VSMac won't be able to parse it.
It sounds like most of us are moving towards using VSCode going forward, so maybe it's alright to take this proposed change if VSMac can't handle this MSBuild structure.
There was a problem hiding this comment.
It sounds like most of us are moving towards using VSCode going forward, so maybe it's alright to take this proposed change if VSMac can't handle this MSBuild structure.
Please don't break VSMac until we've decided that it's the preferred editor for Mac development and have documented how to configure VSCode to build/debug/etc. VFS4G.
There was a problem hiding this comment.
Please don't break VSMac
This was my goal. If I couldn't get this to work with a single csproj file, I was going to fall back to having 2 separate csproj files.
There was a problem hiding this comment.
Please don't break VSMac
This was my goal. If I couldn't get this to work with a single csproj file, I was going to fall back to having 2 separate csproj files.
| <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
| <Import Project="$(SolutionDir)\GVFS\GVFS.Build\GVFS.cs.props" /> | ||
| <Import Project="..\GVFS.Build\GVFS.cs.props" /> |
There was a problem hiding this comment.
wondering why this path is changed.
There was a problem hiding this comment.
Most likely because Visual Studio like to do things like this 😀 😢
There was a problem hiding this comment.
This is because SolutionDir is only defined when building the solution, and is not defined when building the project directly
There was a problem hiding this comment.
One thing I've done in the past is to define an MSBuild property <RepoRoot> in a Directory.Build.props file in the root of the repository.
Projects can use $(RepoRoot) if they want to use an absolute path (rather than a maybe more brittle relative one), without needing the Solution build to set $(SolutionDir).
alameenshah
left a comment
There was a problem hiding this comment.
Testing notes -
- Getting this error. Should we update the
ProductUpgrader.UpgraderToolAndLibslist? Wouldn't the dependent assemblies be different now betweennetcoreandnetframework?
> gvfs upgrade --confirm
Checking for GVFS upgrades...Succeeded
New version 1.0.19074.2 is available.
Launching upgrade tool...
ERROR: Could not launch upgrade tool. File copy error - Could not find file 'C:\Program Files\GVFS\Microsoft.Diagnostics.Tracing.EventSource.dll'.
| <!-- ItemGroup Conditions are not supported on VS for Mac and Choose/When must be | ||
| Used instead, see https://github.com/mono/monodevelop/issues/7417 --> | ||
| <Choose> | ||
| <When Condition="'$(OS)' == 'Windows_NT'"> |
There was a problem hiding this comment.
The existing pattern to have separate csproj for Mac and Windows (like in GVFS.Mount project) helps avoid the need to do platform checks like this. But your approach of keeping a single project file for both platforms looks cleaner. Also now we end up having 2 different patterns (existing pattern of separate platform specific csproj files and this new common csproj with platform specific source code inclusions.)
It would be good if we could discuss and decide on a single pattern that we could follow consistently. @nickgra, @wilbaker, @kewillford, @jrbriggs - thoughts?
There was a problem hiding this comment.
If we can have a single file for both targets, I think that is preferable in the long run. If we can make it work now, I view this as a step in the right direction. At this point, I don't see any blockers in having everything as a single file (debugging on VS for Mac works, I will look again and make sure everything works on VS for Windows).
If there is a problem with using a single file, then my plan was to fall back to having separate projects.
There was a problem hiding this comment.
It would be good if we could discuss and decide on a single pattern that we could follow consistently. @nickgra, @wilbaker, @kewillford, @jrbriggs - thoughts?
When @nickgra updated FastFetch to be cross-platform he was able to use with a single csproj (although I believe in that case it's .NET Core on both platforms).
I believe that historically we couldn't do this because the ProjFS nuget package was incompatible with PackageReference. Now that the layout has been fixed we should be able to start switching to using single projects (see also #94).
cc: @nickgra for his thoughts
There was a problem hiding this comment.
I think long term we want to move everything to .NET Core and moving to a single project is a good step in that direction. IIRC, PackageReference was what was stopping us from doing this.
If this works fine on VSMac, I'm happy with this solution for now, although it does have the con of making us unable to build Mac on Windows as William called out in another comment.
|
The changes look good. A few things to consider before merging.
|
a379d3d to
ad31609
Compare
| <RootNamespace>GVFS.Upgrader</RootNamespace> | ||
| <GenerateAssemblyInfo>false</GenerateAssemblyInfo> | ||
|
|
||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
There was a problem hiding this comment.
As best I can tell AllowUnsafeBlocks was not set before, can this line be removed?
There was a problem hiding this comment.
I had thought it was needed when building the project, but apparently not. I will remove it.
| <ItemGroup> | ||
| <ProjectReference Include="..\GVFS.Platform.Mac\GVFS.Platform.Mac.csproj" /> | ||
| <Compile Include="..\GVFS.PlatformLoader\PlatformLoader.Mac.cs"> | ||
| <Link>PlatformLoader.Mac.cs</Link> |
There was a problem hiding this comment.
I guess this is the one downside to having a single csproj, it means that each platform can only build their own version (at least until we can find an alternative to Condition="'$(OS)').
I'm thinking that might be preferable to doubling the number of projects though.
There was a problem hiding this comment.
I guess this is the one downside to having a single csproj, it means that each platform can only build their own version (at least until we can find an alternative to Condition="'$(OS)').
One other thought here, the long term goal is to get everything on .NET Core, and I think switching to single projects is a step in that direction.
There was a problem hiding this comment.
I guess this is the one downside to having a single csproj, it means that each platform can only build their own version (at least until we can find an alternative to Condition="'$(OS)').
Another option I was thinking about (not for this PR) might be to condition on the RunTime identifier (or a combination of target framework and runtime identifier).
|
@nickgra can you take a look at this PR when you have a few minutes? There aren't too many changes and you have a lot of familiarity in this area. Thanks! |
70a5a39 to
d4f971a
Compare
nickgra
left a comment
There was a problem hiding this comment.
Approved with suggestions.
I think this approach is another step in the journey of .NET Core-ifying the product.
|
|
||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> | ||
| <RuntimeIdentifiers>osx-x64</RuntimeIdentifiers> |
There was a problem hiding this comment.
What @mjcheetham proposed seems like it should work, but I bet VSMac won't be able to parse it.
It sounds like most of us are moving towards using VSCode going forward, so maybe it's alright to take this proposed change if VSMac can't handle this MSBuild structure.
| <!-- ItemGroup Conditions are not supported on VS for Mac and Choose/When must be | ||
| Used instead, see https://github.com/mono/monodevelop/issues/7417 --> | ||
| <Choose> | ||
| <When Condition="'$(OS)' == 'Windows_NT'"> |
There was a problem hiding this comment.
I think long term we want to move everything to .NET Core and moving to a single project is a good step in that direction. IIRC, PackageReference was what was stopping us from doing this.
If this works fine on VSMac, I'm happy with this solution for now, although it does have the con of making us unable to build Mac on Windows as William called out in another comment.
GVFS.Upgrader will be run on both Windows and non-Windows platforms. This enables a netcore version of the project to be built along side a netframework version. Update tests to run in the base unit test project to follow the implementation.
GVFS.Upgrader will be run on both Windows and non-Windows platforms.
This enables a netcore version of the project to be built along side a
netframework version.
Update tests to run in the base unit test project to follow the
implementation.