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

Project files not found by AssemblyInfoPatcher if in different directory from solution #64

Open
chefhoobajoob opened this issue May 19, 2016 · 7 comments
Labels

Comments

@chefhoobajoob
Copy link

chefhoobajoob commented May 19, 2016

I have a source tree like so, where the solution file defines the paths to its constituent projects:

<root>
   +---rootProject.sln
   +---src
        |
        +---project-a
        |       +---project-a.csproj
        +---project-b
                +---project-b.csproj

This minimal configuration appears to successfully build every project in the solution:

msbuild {
  solutionFile = 'rootProject.sln'
  targets = ['Clean', 'Rebuild']
  configuration = 'Release' // this should be included in the Readme
}

And, I was hoping that setting the assembly versions for all of the projects would be as simple as:

assemblyInfoPatcher {
  version = project.version + '.0'
  fileVersion = version + '.' + buildNumber
  projects = 'project-a', 'project-b'
}

...but no matter what I configure for the patcher, even if I omit the projects configuration, the patcher always complains:

Project project-a not found in solution

So, it appears that the patcher is not expecting or using the path information that is specified in the project entries for the solution file.

@gluck
Copy link
Contributor

gluck commented May 19, 2016

This should work, do you have the full stack of the error you get ? (gradlew -is)
The patcher only patches the main project by default, because it wouldn't make sense to patch NUnit projects (for instance) in same solution, but listing the project names as you did is the expected usage.

Thx !

@gluck gluck added the bug label May 19, 2016
@chefhoobajoob
Copy link
Author

chefhoobajoob commented May 19, 2016

It's not very informative, but here's the output from gradlew -is leading up to the message above:

Starting Build
Settings evaluated using settings file 'C:\master\settings.gradle'.
Projects loaded. Root project using build file 'C:\Users\hoobajoob\Documents\rootProject\build.gradle'.
Included projects: [root project 'rootProject']
Evaluating root project 'rootProject' using build file 'C:\Users\hoobajoob\Documents\rootProject\build.gradle'.
Parsing file C:\Users\hoobajoob\Documents\rootProject\rootProject.sln ...
Project project-a not found in solution

@gluck
Copy link
Contributor

gluck commented May 19, 2016

This error suggest you configured msbuild task with:

msbuild {
    project = 'project-a'
     ...
}

It also doesn't seem to be relevant to the assembly info patcher task, so you'll probably still have the error if you remove the task (do you ?).
Maybe attach you sln content ?

@chefhoobajoob
Copy link
Author

chefhoobajoob commented May 19, 2016

There are other problems - the msbuild command that is run does not appear to honor the Visual Studio version specified in the solution file.

Here are the first few lines of the solution file:

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "project-a", "source\project-a\project-a.csproj", "{604034BF-0738-44A4-96B7-5D8F5EAA9ADB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "project-a.test", "source\project-a\project-a.test\project-a.test.csproj", "{54ACF628-D702-4EA1-9460-138A8FFE89A2}"
    ProjectSection(ProjectDependencies) = postProject
        {604034BF-0738-44A4-96B7-5D8F5EAA9ADB} = {604034BF-0738-44A4-96B7-5D8F5EAA9ADB}
    EndProjectSection
EndProject

...note that it is a Visual Studio 2010 solution. But, here is the output from gradlew -is:

Executing task ':msbuild' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
Resolved MSBuild to C:\Program Files (x86)\MSBuild\14.0\bin\
Starting process 'command 'C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe''. Working directory: C:\Users\hoobajoob\rootProject Command: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe /nologo C:\Users\hoobajoob\rootProject\rootProject.sln /t:Clean;Rebuild /v:normal /p:Project=project-a /p:Configuration=Release
Successfully started process 'command 'C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe''
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 5/19/2016 8:39:55 AM.

...it appears to be using whatever the latest version of Visual Studio is installed on the system, rather than what's specified in the solution file.

This is the msbuild config in build.gradle:

plugins {
  id "com.ullink.msbuild" version "2.14"
}

msbuild {
  solutionFile = 'rootProject.sln'
  targets = ['Clean', 'Rebuild']
  configuration = 'Release'
}

assemblyInfoPatcher {
  version = project.version + '.0'
  fileVersion = project.version + '.' + buildNumber
  projects = [ "project-a" ]
}

@chefhoobajoob
Copy link
Author

Curioser and curioser.

When I remove the patcher config, the not found in solution message goes away.

But, I should have checked the AssemblyInfo.cs file, because despite this message, the version number is getting substituted.

Not sure what the message is telling me, but it appears to be a red herring.

Unfortunately, I can't get it to run the right version of msbuild, though. Any ideas there?

@chefhoobajoob
Copy link
Author

Should I open a separate issue for the msbuild version?

@gluck
Copy link
Contributor

gluck commented May 30, 2016

You can configure the msbuild version like that:

msbuild {
    version = '10.0'
}

Regarding the other error I'm out of guesses sorry.

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

No branches or pull requests

2 participants