Closed Skulblaka closed 6 years ago
As reference (for myself), dotnet build
gives this error when invoked in a directory with no solution/project files:
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
And this error when it contains more than one:
MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
In both cases the exit code is 1.
Right now it seems it might not even be possible to run this tool when there isn't exactly one csproj file in the directory anyway. For one thing it's a per-project tool meaning it's impossible to run it without being in a directory with a project folder. If you try you get this:
$ dotnet setversion
No executable found matching command "dotnet-setversion"
On the other hand, if you try to run the tool in a project with more than one csproj file, you get the following error before the entry-point of the tool gets executed:
$ dotnet setversion
Specify which project file to use because this '<<folder>>' contains more than one project file.
With seemingly no way to actually specify the project file to use.
Because of this, I think this is a non-issue in this tool's current state. However, I'll probably need to convert this tool into a global tool to support #6 in which case this will become a concern. I'll keep this open for now.
I have a feature branch in my fork where I converted it into a global tool including a migration guide. Do you want me to create another pull request after you merged with the current one?
Sure, sounds good. Going to hold off on this until I know why the CI build is failing though. I RDP'd into the build server and for some reason the PowerShell console on it gets stuck executing the dotnet setversion
command (it prints the "Setting version: ..." message immediately though and it's just a return 0;
after that).
Will need access to a Windows machine to see if I can reproduce the problem locally. I'll have access to one on Monday.
Closing this as running dotnet-setversion
isn't possible in a directory with two csproj files, so Directory.EnumerateFileSystemEntries(...)
will never emit more than one value.
Right now,
gitversion
usesDirectory.EnumerateFileSystemEntries(...).First()
to find a file to apply the given version. I would expect execution to fail if there were multiple csproj files in a directory, correlating to other commands like e.g.dotnet build
: