Skip to content
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

paket pack fails when there is no build configuration named "Release" #1262

Closed
agross opened this issue Nov 26, 2015 · 10 comments · Fixed by #1269
Closed

paket pack fails when there is no build configuration named "Release" #1262

agross opened this issue Nov 26, 2015 · 10 comments · Fixed by #1269
Labels

Comments

@agross
Copy link
Contributor

agross commented Nov 26, 2015

csproj (irrelevant lines removed):

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.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')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
    <OutputPath>..\..\build\bin\dialer\</OutputPath>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

As you can see we only have the "Release|x86" config. Paket 1.32 packed this just fine with type project in paket.template, but 2.28 yields:

.paket/paket.exe pack output build/deploy
Paket version 2.28.0.0
Paket failed with:
    Unable to find Release output path node in file above.csproj

I don't know how the "find output path" logic changed in particular, but maybe use "Release.*" as a fallback when looking for the OutputPath.

forki added a commit that referenced this issue Nov 27, 2015
@forki
Copy link
Member

forki commented Nov 27, 2015

I created a failing test in 106215a

@amazingant do you have an idea how we can handle this?

@forki forki added the bug label Nov 27, 2015
@allykzam
Copy link
Contributor

@forki I know this isn't the desired answer, but this behavior looks correct to me. The shortened project file from @agross says on line 6 to target AnyCPU if a platform isn't specified, and there isn't a Release build configuration for AnyCPU. IMO, fixing this accurately would mean adding a platform parameter to paket's pack command, or perhaps just some kind of projectflag parameter that could be given multiple times? e.g., paket pack output build/deploy projectflag Platform=x86.

To quickly patch over this and get the issue resolved, ProjectFile.GetOutputDirectory could just call GetPropertyWithDefaults multiple times with different platform options and use the first one with a result.

@agross
Copy link
Contributor Author

agross commented Nov 27, 2015

@amazingant One could argue the project file is incorrect. What should be fixed, in your opinion?

I'm not saying paket shouldn't change its "finding" logic, rather that VS created the csproj and it seems legit to VS, but not paket.

@forki
Copy link
Member

forki commented Nov 27, 2015

(just to clarify why the older version worked. At that time we didn't analyzed at all, so by pure luck it worked)

@allykzam
Copy link
Contributor

@agross Knowing that you can do this in VS' configuration manager, your project file looks perfectly legitimate to me:

untitled

(I think VS keeps this information in the solution file?) Unfortunately, paket doesn't know about this "Debug means x86 for project Y and AnyCPU for project Z" info.

Perhaps the best way to handle this would be to add an optional parameter to the pack command, and if it isn't provided, try all of the known platform targets and see if any result in an output path. It would allow being explicit about what you want, but it would also resolve your issue without you having to change anything.

Your thoughts, @forki? There's a nice list of platforms from the C# compiler documentation here that paket could check against.

@forki
Copy link
Member

forki commented Nov 27, 2015

mhm. at the moment we don't report any path, right? Maybe we should default to whatever we find with release then!?

@agross
Copy link
Contributor Author

agross commented Nov 27, 2015

@amazingant

I think VS keeps this information in the solution file?

Yes, this is the case here.

and if it isn't provided, try all of the known platform targets and see if any result in an output path

That would be fine with me. In this case, perhaps log some warnings about that and tell the user what platforms have been tried and which has been selected.

@agross
Copy link
Contributor Author

agross commented Dec 1, 2015

@amazingant

Thank you very much, our build turned green again :-)

I think the output can be improved when you have multiple paket.template files. What do you think?

No platform specified; found output path node for the x86 platform after failing to find one for the following: AnyCPU32BitPreferred, AnyCPU
No platform specified; found output path node for the AnyCPU platform after failing to find one for the following:
No platform specified; found output path node for the AnyCPU platform after failing to find one for the following:
No platform specified; found output path node for the x86 platform after failing to find one for the following: AnyCPU32BitPreferred, AnyCPU
No platform specified; found output path node for the AnyCPU platform after failing to find one for the following:
No platform specified; found output path node for the AnyCPU platform after failing to find one for the following:
Packed: Foo\paket.template
Packed: Bar\paket.template
Packed: Baz\paket.template

@allykzam
Copy link
Contributor

allykzam commented Dec 2, 2015

@agross Just took a look at the build output for one of my projects and saw the same. Initially confused me seeing after failing to find one for the following: with nothing "following". I'll take a look at this when I get a chance, and see if I can clean it up.

@agross
Copy link
Contributor Author

agross commented Dec 2, 2015

👍 That would be great!

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

Successfully merging a pull request may close this issue.

3 participants