Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Switch to package references #475

Merged
merged 7 commits into from
Sep 14, 2017
Merged

Conversation

twsouthwick
Copy link
Member

This is a second attempt at it (see #454 for the first). It now creates the VSIX, and uses the pack target for nuget package creation.

@twsouthwick
Copy link
Member Author

@conniey Since this now uses the pack target for nuget package creation, I'll probably need to update the build scripts. It requires msbuild to build right now - do we need to support dotnet cli?

@@ -8,10 +8,16 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputDrop>$(TF_BUILD_BINARIESDIRECTORY)</OutputDrop>
<NoWarn>$(NoWarn),1570,1572,1573,1574,1591,1701</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you added 1701 because of all those redirect warnings... is it possible that we may miss one that results in a runtime error? I had looked awhile ago at resolving these somehow... but to no avail. :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, but it's worse to have 30000 other errors and miss important warnings from those. We'll catch a runtime error at runtime so at least they'll be caught somewhere

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.. It is cumbersome to filter through all them.

Copy link
Member

@conniey conniey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that Directory.Build.targets and props were not longer being imported into any of the projects... how are they getting signed? I may have missed some change somewhere...

@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed you removed dir.props/dir.targets from this... will the assembly still be signed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directory.Build.{targets|props} is a magic file that gets included by all projects below it. See the msbuild 15 announcements for details: https://docs.microsoft.com/en-us/visualstudio/msbuild/what-s-new-in-msbuild-15-0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. that is pretty magical.

<PackageReference Include="Microsoft.VisualStudio.Composition" Version="14.2.19-pre" />
<PackageReference Include="Microsoft.VisualStudio.OLE.Interop" Version="7.10.6070" />
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem" Version="14.1.170-pre" />
<PackageReference Include="Microsoft.VisualStudio.SDK.VsixSuppression" Version="14.1.33" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! What does the VsixSupression package do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, not sure. I just copied the packages that had been included.....

@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.props" Condition="Exists('..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to include Directory.Build.props/targets to sign assemblies?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, it will be auto imported (see above response)

<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call on moving those netstandard packages into a targetframework dependent group... saves a lot of binding headaches.

</assemblyBinding>
</runtime>
<!-- Uncomment this to see diagnostics -->
<!--<system.diagnostics>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to keep this? It is nice to have the trace listener when I need a stack trace for users who have failures in their client application since we usually abstract it into a "Failed" output. :/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem - I've added it back

using Microsoft.VisualStudio.TestTools.UnitTesting;
using NSubstitute;

namespace ApiPortVS.Tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the removal of these unit tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a duplicated test (must have been renamed at some point to OptionsViewModelTest but this duplicated existed. It also still uses MSTest while the other one uses Xunit

<PackageReference Include="Microsoft.Composition" Version="1.0.27" />
<PackageReference Include="Microsoft.Tpl.Dataflow" Version="4.5.24" />
<PackageReference Include="Microsoft.VisualStudio.ComponentModelHost" Version="14.0.25424" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="14.2.19-pre" />
Copy link
Member

@conniey conniey Sep 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The packages don't match the original ones... so I am getting downgrade warnings during the restore.

The app.config;

<package id="Microsoft.VisualStudio.ComponentModelHost" version="15.0.26201" targetFramework="net46" /> 
<package id="Microsoft.VisualStudio.Composition" version="15.0.70" targetFramework="net46" /> 

Same with Microsoft.VisualStudio.Validation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got that at one point and fixed it. Where are you seeing it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I'm doing the restore NuGet packages for solution or rebuild in visual studio 2017.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
NU1605: Detected package downgrade: Microsoft.VisualStudio.Composition from 15.0.70 to 14.2.19-pre. Reference the package directly from the project to select a different version. 
 ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.ProjectSystem (>= 15.0.751) -> Microsoft.VisualStudio.Composition (>= 15.0.70) 
 ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.Composition (>= 14.2.19-pre)
NU1605: Detected package downgrade: Microsoft.VisualStudio.Validation from 15.0.82 to 14.1.111. Reference the package directly from the project to select a different version. 
 ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.ProjectSystem (>= 15.0.751) -> Microsoft.VisualStudio.Validation (>= 15.0.82) 
 ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.Validation (>= 14.1.111)
NU1605: Detected package downgrade: Microsoft.VisualStudio.Validation from 15.3.15 to 14.1.111. Reference the package directly from the project to select a different version. 
 ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.Threading (>= 15.3.35) -> Microsoft.VisualStudio.Validation (>= 15.3.15) 
 ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.Validation (>= 14.1.111)
NU1605: Detected package downgrade: Microsoft.VisualStudio.ProjectSystem from 15.0.751 to 14.1.170-pre. Reference the package directly from the project to select a different version. 
 ApiPort.Vsix (>= 1.0.0) -> ApiPort.VisualStudio (>= 1.0.0) -> ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.ProjectSystem (>= 15.0.751) 
 ApiPort.Vsix (>= 1.0.0) -> ApiPort.VisualStudio (>= 1.0.0) -> Microsoft.VisualStudio.ProjectSystem (>= 14.1.170-pre)
NU1605: Detected package downgrade: Microsoft.VisualStudio.Threading from 15.3.35 to 14.1.131. Reference the package directly from the project to select a different version. 
 ApiPort.Vsix (>= 1.0.0) -> ApiPort.VisualStudio (>= 1.0.0) -> ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.Threading (>= 15.3.35) 
 ApiPort.Vsix (>= 1.0.0) -> ApiPort.VisualStudio (>= 1.0.0) -> Microsoft.VisualStudio.Threading (>= 14.1.131)
NU1605: Detected package downgrade: Microsoft.VisualStudio.ProjectSystem from 15.0.751 to 14.1.170-pre. Reference the package directly from the project to select a different version. 
 ApiPort.VisualStudio (>= 1.0.0) -> ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.ProjectSystem (>= 15.0.751) 
 ApiPort.VisualStudio (>= 1.0.0) -> Microsoft.VisualStudio.ProjectSystem (>= 14.1.170-pre)
NU1605: Detected package downgrade: Microsoft.VisualStudio.Threading from 15.3.35 to 14.1.131. Reference the package directly from the project to select a different version. 
 ApiPort.VisualStudio (>= 1.0.0) -> ApiPort.VisualStudio.2017 (>= 1.0.0) -> Microsoft.VisualStudio.Threading (>= 15.3.35) 
 ApiPort.VisualStudio (>= 1.0.0) -> Microsoft.VisualStudio.Threading (>= 14.1.131)
1>------ Rebuild All started: Project: Microsoft.Fx.Portability, Configuration: Debug Any CPU ------
1>Microsoft.Fx.Portability -> D:\git\conniey\dotnet-apiport\bin\Debug\Microsoft.Fx.Portability\net46\Microsoft.Fx.Portability.dll
1>Microsoft.Fx.Portability -> D:\git\conniey\dotnet-apiport\bin\Debug\Microsoft.Fx.Portability\netstandard1.3\Microsoft.Fx.Portability.dll
2>------ Rebuild All started: Project: Microsoft.Fx.Portability.Cci, Configuration: Debug Any CPU ------
2>Microsoft.Fx.Portability.Cci -> D:\git\conniey\dotnet-apiport\bin\Debug\Microsoft.Fx.Portability.Cci\netstandard1.3\Microsoft.Fx.Portability.Cci.dll
3>------ Rebuild All started: Project: ApiPort.VisualStudio.Common, Configuration: Debug Any CPU ------
3>  ApiPort.VisualStudio.Common -> D:\git\conniey\dotnet-apiport\bin\Debug\ApiPort.VisualStudio.Common\ApiPort.VisualStudio.Common.dll
4>------ Rebuild All started: Project: ApiPort.VisualStudio.2015, Configuration: Debug Any CPU ------
5>------ Rebuild All started: Project: ApiPort.VisualStudio.2017, Configuration: Debug Any CPU ------
4>  ApiPort.VisualStudio.2015 -> D:\git\conniey\dotnet-apiport\bin\Debug\ApiPort.VisualStudio.2015\ApiPort.VisualStudio.2015.dll
5>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
5>  ApiPort.VisualStudio.2017 -> D:\git\conniey\dotnet-apiport\bin\Debug\ApiPort.VisualStudio.2017\ApiPort.VisualStudio.2017.dll
6>------ Rebuild All started: Project: ApiPort.VisualStudio, Configuration: Debug Any CPU ------
6>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
6>CSC : error CS0016: Could not write to output file 'D:\git\conniey\dotnet-apiport\bin\Debug\eoy1ssmx\eoy1ssmx.xml' -- 'Could not find a part of the path 'D:\git\conniey\dotnet-apiport\bin\Debug\eoy1ssmx\eoy1ssmx.xml'.'
7>------ Rebuild All started: Project: ApiPort.Vsix, Configuration: Debug Any CPU ------
7>C:\Users\conniey\.nuget\packages\microsoft.vssdk.buildtools\15.1.192\tools\VSSDK\Microsoft.VsSDK.targets(80,5): warning VSSDK1018: Targets version (1.0.179.29298) and build task version (1.0.249.40350) do not match.  Restarting Visual Studio could help fix this issue.
========== Rebuild All: 5 succeeded, 2 failed, 0 skipped ==========

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - seems that when you have WPF assets, it will create a tmp project for baml generation. Pull latest commit and try building again (do a git clean, though, before)

@twsouthwick
Copy link
Member Author

@conniey I got the windows builds to work, but can't figure out why the *nix ones are failing. Any ideas?

@conniey
Copy link
Member

conniey commented Sep 13, 2017

@twsouthwick
Looking at the log files, https://ci2.dot.net/job/Microsoft_dotnet-apiport/job/master/job/osx10.12_debug_prtest/97/consoleFull#110736192979494335-f7bd-47d0-8771-8661e00c2db2...
It appears when it is trying to run the tests, it tries to do a dotnet restore on the root directory, and as a result, the ApiPort.VisualStudio projects are restored. Unfortunately, the VSSDK is not installed on *nix systems, so it fails.
It appears you have to alter this line: https://github.com/Microsoft/dotnet-apiport/blob/master/build.sh#L66, by either adding dotnet restore <Path to full csproj> or doing a pushd/popd.

@conniey
Copy link
Member

conniey commented Sep 13, 2017

do we need to support dotnet cli?

We need to support it for building on non-Windows systems... We've had a couple of customers issue bugs because they were unable to build/run ApiPort on their Linux machine.

@conniey
Copy link
Member

conniey commented Sep 13, 2017

@twsouthwick
Running build.cmd seems to result in an error as well... I can see it in the CI builds but it doesn't appear to be flagged as a build failure. (Possibly because there are still *.trx files to output?)

Testing ApiPortVS.Tests.csproj. Output: ApiPortVS.Tests.2017-09-13.04_44_11.trx
D:\git\conniey\dotnet-apiport\src\ApiPort.VisualStudio\ApiPort.VisualStudio.csproj(186,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.0.2-vspre-006949\Microsoft\VisualStudio\v15.0\VSSDK\Microsoft.VsSDK.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Test run for D:\git\conniey\dotnet-apiport\bin\Release\ApiPortVS.Tests\net46\ApiPortVS.Tests.dll(.NETFramework,Version=v4.6)
Microsoft (R) Test Execution Command Line Tool Version 15.3.0-preview-20170628-02
Copyright (c) Microsoft Corporation.  All rights reserved.

The test source file "D:\git\conniey\dotnet-apiport\bin\Release\ApiPortVS.Tests\net46\ApiPortVS.Tests.dll" provided was not found.

@twsouthwick
Copy link
Member Author

@dotnet-bot test this please

@mmitche
Copy link
Member

mmitche commented Sep 14, 2017

@dotnet-bot test this please

@microsoft microsoft deleted a comment from twsouthwick Sep 14, 2017
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MicroBuild.Core" Version="0.2.0" />
Copy link
Member

@conniey conniey Sep 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the MicroBuild.Core and Microsoft.VSSDK.BuildTools developer dependencies will flow into the NuGet package. Change all these to something like:

<PackageReference Include="MicroBuild.Core" Version="0.2.0">
    <PrivateAssets>All</PrivateAssets>
</PackageReference> 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed - moved the microbuild.core references to Directory.Build.targets

Copy link
Member

@conniey conniey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@twsouthwick twsouthwick merged commit 741cdda into microsoft:master Sep 14, 2017
@twsouthwick twsouthwick deleted the proj-files branch September 14, 2017 20:08
@@ -147,7 +46,6 @@
</ProjectReference>
<ProjectReference Include="..\Microsoft.Fx.Portability\Microsoft.Fx.Portability.csproj">
<Project>{8d84ec23-9977-4cc8-b649-035ffae9664c}</Project>
<AdditionalProperties>TargetFramework=net46</AdditionalProperties>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twsouthwick This line needs to be added back.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants