Port GenerateDepsFile and GenerateRuntimeConfigurationFiles#8
Port GenerateDepsFile and GenerateRuntimeConfigurationFiles#8eerhardt merged 6 commits intodotnet:masterfrom
Conversation
…untimeConfigurationFiles. Also, set TargetExt to '.dll' for .NET Core projects, even projects with managed entry points $(OutputType) == 'exe'.
NuGet.config
Outdated
| <clear /> | ||
| <add key="nugetbuild" value="https://www.myget.org/F/nugetbuild/api/v3/index.json" /> | ||
| <add key="dotnet-buildtools" value="https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json" /> | ||
| <!-- dotnet-core-test needs to be changed to dotnet-core once the netstandard1.3 DependencyModel package is available --> |
|
We don't want to include project.lock.json? |
|
Rather than comment on every TODO, just make sure we file tracking bugs for them. |
|
@333fred are you asking if we want to check-in the lock file? |
|
Yeah. You included src/Tasks/Microsoft.DotNet.Core.Build.Tasks.UnitTests/simple.dependencies.project.lock.json, do we actually want it included? That's a giant file. |
|
I think the intent of that file is to be an Unit Test input in which case we do want to check it in so that updates/changes in NuGet do not cause false alarms in our test bed. In general, however, we don't want to check in the lock files as they are RID-specific and can be computed as a function of the project.json and the package sources. We've also seen checked-in lock files cause issues in some contexts e.g. TFS wherein they cannot be updated until checked out. We do avoid |
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <_ProjectLockFilePath>$(MSBuildProjectDirectory)/project.lock.json</_ProjectLockFilePath> |
There was a problem hiding this comment.
_ProjectLockFilePath [](start = 5, length = 20)
In the package dependency task, we also address the case where the project file is $(MSBuildProjectName).project.json, setting the lock file in those cases to $(MSBuildProjectName).project.lock.json. Is this possible in .NET Core, or is this just legacy we should get rid of?
There was a problem hiding this comment.
Eventually, I think it should be the NuGet team that defines this property. And all the places that need to read the lock file use the property defined by the NuGet .props file.
/cc @emgarten to get his thoughts.
There was a problem hiding this comment.
In the current project.json-based project system, the lock file is always named project.lock.json. See https://github.com/dotnet/cli/blob/04f40f906dce2678d80fb9787e68de76ee6bf57e/src/Microsoft.DotNet.ProjectModel/Graph/LockFile.cs#L13
|
👍 Once this is in, I will stage my changes on it and resolve merge conflicts |
| @@ -1,4 +1,11 @@ | |||
| <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
There was a problem hiding this comment.
Target and Props need copyright headers. Mine also include the standard warnings about not modifying them
There was a problem hiding this comment.
Target and Props need copyright headers. Mine also include the standard warnings about not modifying them
@natidea can you shoot me an example of how it should look that I can copy?
There was a problem hiding this comment.
@piotrpMSFT is correct here. The input into the system being tested is the project.lock.json file. And so the tests need a lock file to pass into the component under test. We could try to generate the project.lock.json file during the test, but that would involve calling "restore", which could hit the internet. And in my opinion, unit tests should try limiting their dependencies as much as possible, so the test doesn't break for some un-related reason. The lock files I'm checking in were generated manually using "dotnet new" for the "dotnet.new" test. And then I added two simple dependencies for the "simple.dependency" test. I'm open to other ideas on how to test these components that need lock files. But I don't want our unit tests hitting the internet. @natidea - how do you plan on testing your task/targets that need lock files as an input? |
|
@eerhardt I'll use sample project.json files checked in as well |
…e LockFile object across task invocations.
|
|
||
| dotnet build3 $RepoRoot\core-sdk.sln /nologo /m /p:Configuration=$Configuration /p:Platform=$Platform | ||
| # TODO: add /m when the https://github.com/Microsoft/msbuild/pull/859 is in the CLI that we are using to build | ||
| dotnet build3 $RepoRoot\core-sdk.sln /nologo /p:Configuration=$Configuration /p:Platform=$Platform |
There was a problem hiding this comment.
For the ci builds, is there any reason for us to build a different platform, or should we just leave it as is?
There was a problem hiding this comment.
The build fails without setting this property. I'm not sure if it is because our .sln file is configured incorrectly or not.
Feel free to fix it.
There was a problem hiding this comment.
It's because you don't have a default set in the targets. Usually this lives in the project file itself, but as part of the cleanup we'll pull it out into a targets.
There was a problem hiding this comment.
This is the error I get when I don't set this property:
F:\core-sdk\core-sdk.sln.metaproj : error MSB4126: The specified solution configuration "Debug|x64" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration. [F:\core-sdk\core-sdk.sln]
There was a problem hiding this comment.
Looks like it is a problem with dotnet build3. See https://github.com/dotnet/cli/blob/feature/msbuild/src/dotnet/commands/dotnet-build3/MSBuildForwardingApp.cs#L41
It is explicitly setting the current architecture as the Platform. That's why this is failing.
There was a problem hiding this comment.
Shouldn't it set some form of default platform? What is the alternative here?
There was a problem hiding this comment.
I think the alternative here is that the .csproj (or the Sdk .props/.targets) declares its default. And the tool running MSBuild doesn't specify it.
|
OK, I've responded to all feedback. |
| <UserRuntimeConfig Condition=" '$(UserRuntimeConfig)' == '' ">$(MSBuildProjectDirectory)/runtimeconfig.template.json</UserRuntimeConfig> | ||
|
|
||
| <VersionPrefix Condition=" '$(VersionPrefix)' == '' ">1.0.0</VersionPrefix> | ||
| <VersionSuffix Condition=" '$(VersionSuffix)' == '' "></VersionSuffix> |
There was a problem hiding this comment.
What is the point of this? Doesn't it just set VersionSuffix to empty string if it's empty string?
There was a problem hiding this comment.
It does. The point of this is to declare VersionSuffix as a property, and give it a default value. That way the next line doesn't materialize the property "out of thin air". This gives a little more structure to what properties are available, because how else are you going to know that $(VersionSuffix) can be set?
There was a problem hiding this comment.
I don't understand what that means. No dev is going to be looking through the targets looking for properties to set, they are going to be looking at docs.
There was a problem hiding this comment.
Well, I'm a dev. And I went looking through the CSharp .targets and that's how I found about about the $(TargetExt) property. I'm not sure which docs I should have been looking in to find out about it.
If this is not a conventional pattern, feel free to remove it.
Port GenerateDepsFile and GenerateRuntimeConfigurationFiles
Updating the ReadMe
This change adds the tasks and targets from the dotnet/cli repo that will generate the .deps.json and runtimeconfig.json files.
I ported the tests as well. The tests build, but there is currently no way to execute the tests.
@davkean @natidea @333fred @brthor @livarcocc @piotrpMSFT