Skip to content

Unblock having non-anycpu configurations by always setting output path #351

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

Merged
merged 2 commits into from
Nov 3, 2016

Conversation

nguerrera
Copy link
Contributor

@nguerrera nguerrera commented Nov 2, 2016

Also, set PlatformTarget to match Platform for x86 and x64 as VS would
do for classic projects.

This is enough to close all of the following:

But there is remaining work to manage (add/remove/rename) configurations and platforms, which is now tracked by:

Also, set PlatformTarget to match Platform for x86 and x64 as VS would
do for classic projects.

Finally, fix nuget pack output path for single-targeting project.
@nguerrera
Copy link
Contributor Author

Scenario

Add configurations or platforms to project in VS and have it build without having to make manual modifications to project.

Also, get a consistent package output path regardless of whether cross-targeting is used or not

Bugs

#328
#203
#318
dotnet/project-system#527

Workarounds

Set OutputPath and PackageOutputPath manually in csproj

Risk

Low

Performance Impact

None

Regression Analysis

Not a regression

@nguerrera
Copy link
Contributor Author

@srivatsn @dsplaisted @dotnet/project-system Please review

<IntermediateOutputPath Condition="!HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
</PropertyGroup>

<!-- Set the package output path (for nuget pack target) now, before the TargetFramework is appended -->
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there's a way to solve this right now, but it seems to me that you wouldn't want the NuGet package generated in an x86 or x64 folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I filed #329 to make sure we have settled on default output paths. There is definitely tension between traditional VS concept of $(Platform) and nuget concept of $(RuntimeIdentifier), etc. Everything is configurable, though, so I think we're bound to have some compromise on the defaults.

-->
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
<Platform Condition="'$(Platform)'==''">AnyCPU</Platform>
Copy link
Member

Choose a reason for hiding this comment

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

You also have the Configuration and Platform defaults in Microsoft.NET.Sdk.props, is there a reason to also put it in this targets file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just being defensive in case the props aren't imported, though you probably have other problems. Regardless, the duplication pre-exists this change, so I'll leave de-duping as a separate exercise.

@@ -60,6 +80,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<!-- Temp Hack: https://github.com/Microsoft/msbuild/issues/1045: This is the only before common targets hook available to us, but using it is hijacking a hook that should belong to the user. -->
Copy link
Member

Choose a reason for hiding this comment

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

Hack -> workaround (or did you already change this in another PR?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is already fixed in another PR.

.Should()
.Pass();

buildCommand.GetOutputDirectory("netcoreapp1.0", Path.Combine("x64", "Debug"))
Copy link
Member

Choose a reason for hiding this comment

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

We should probably rename this parameter or otherwise refactor so that we're not passing in x64\Debug as the configuration parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll follow up with a separate test-only change to clean this up.


namespace Microsoft.NET.Pack.Tests
{
public class GivenThatWeWantToPackASimpleLibrary
Copy link
Member

Choose a reason for hiding this comment

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

Is this test related to the OutputPath changes or is it just filling in more general test coverage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is related to the package output path being correct. There are different import paths for x-targeted and single-targeted cases and we only tested x-targeted. My first attempt at fixing this broke the x-targeted test and then I found it prudent to test both cases to prevent fixing one while breaking the other.

@nguerrera
Copy link
Contributor Author

@srivatsn Please review as well.

@MattGertz for approval

@MattGertz
Copy link

Approved.

@nguerrera nguerrera merged commit 34babbf into dotnet:master Nov 3, 2016
@nguerrera nguerrera deleted the outputpath branch November 3, 2016 16:29
GangWang01 pushed a commit to GangWang01/sdk that referenced this pull request Mar 20, 2023
* Fixed error messages

* Removed some unnecessary period characters and one unused string resource.

* Improved MissingLinkToRegistry string resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants