Comments (23)
Hey @roryprimrose.
I started work on this request but I just remembered - you necessarily have to have the project directory as the current working directory in order to call "dotnet setversion". This is the case with all dotnet CLI tools. If you try to call from another directory, you get No executable found matching command "dotnet-setversion"
.
from dotnet-setversion.
Actually, just did some reading and it seems like it'd be possible using the path-based extensibility model. I'll look into it.
from dotnet-setversion.
This might not need to be fixed in your package. All the dotnet CLI verbs require this as well. Weird that they OOTB tasks work on a VSTS build.
I did just find this in the VSTS build tasks repo - microsoft/azure-pipelines-tasks#5977
from dotnet-setversion.
Hmm, to clarify, this would mean that you wouldn't need to figure out the current working directory for the CLI to find your custom setversion verb. You would still need to modify the code to be adaptive to whether a proj file path was one of the arguments.
from dotnet-setversion.
You would still need to modify the code to be adaptive to whether a proj file path was one of the arguments.
Is something like dotnet setversion -f /path/to/your.csproj 0.1.2-beta0003
okay? That's what I've implemented at the moment.
from dotnet-setversion.
The only issue with this is that the VSTS dotnet build task does not include the -f qualifier. Does your change support the following format?
dotnet setversion absolute/path/to/your.csproj 0.1.2-beta0003
That is how the build task will call it.
from dotnet-setversion.
VSTS build tasks are that inflexible? There's no other way to get them to pass the csproj file to the command?
If so, I guess I can make it so it checks if the first argument ends in *.csproj and if so, treats that as the csproj path and expects an argument after that for the version string.
from dotnet-setversion.
from dotnet-setversion.
you are restricting to just csproj which won't support other project types.
What other project types do you have in mind? dotnet-setversion
is designed specifically for projects following the new csproj style (with version information stored in XML under <Project><PropertyGroup><Version>
.
I would probably use File.Exists on the parameter to be sure
The problem is that the changes you're suggesting would already technically be considered a breaking change if we went the way I suggest by checking if the first argument ends in *.csproj. Currently if someone were to use dotnet-setversion to set a version that for whatever reason ended in ".csproj", it would break. But that's a very, very unlikely situation and I think we can safely ignore that possibility.
OTOH, if I use File.Exists
on the argument, then this'd cause unexpected breaking behaviour if they happened to have a file with the same name as the version they were attempting to set. For example, if someone tries to use dotnet-setversion 1.0.2
right now, then that'll set the version of the csproj to 1.0.2 as expected. OTOH, if they actually did have some file called 1.0.2
and attempted to run that command, it would treat the first argument as the file to store the updated version within and look for a second argument as the actual version to set.
from dotnet-setversion.
from dotnet-setversion.
Looks like that guy isn't going to respond. Still need this implemented?
from dotnet-setversion.
I'm not overly bothered because I'm only using this on csproj files :) Let me know if there is a beta package I can test for you.
from dotnet-setversion.
I've had a look at your pull request and it looks like supporting how the VSTS/TFS dotnet build task invokes dotnet.exe will still be an issue. From what I can see in the code, the use of the command line parsing library would require two positional arguments where the first argument is the csproj path and the second is the version. This breaks the prior implementation where the first argument was the version.
Could you use that library with positional arguments but then determine which is the csproj from those arguments rather than assuming that the position is significant? I think that would be the only way you could get this to work without a breaking change.
from dotnet-setversion.
The stuff in the pull request is not relevant anymore, just something I threw together trying to pre-empt the implementation.
How about using a flag to differentiate between the two possible modes of operation? Maybe like dotnet <csproj path> <version> --override-csproj
or dotnet <csproj path> <version> --vsts
?
This will avoid any breaking changes while also involving potentially hairy issues/ambiguities that could arise from trying to figure out if a parameter represents a valid path or not. It also looks like you can just append that modifier flag (--override-csproj
, --vsts
or whatever we decide on) to your VSTS Argument field.
from dotnet-setversion.
Adding --vsts
as an additional argument on the build task should work fine. Let's go with that and see how it works.
from dotnet-setversion.
I've given this a shot. Try installing dotnet-setversion 1.0.3-issue-5-0008. I guess you need to do something similar to this to test it out.
from dotnet-setversion.
Where is this package hosted? It's not on nuget or myget.
from dotnet-setversion.
It's on NuGet but unlisted: https://www.nuget.org/packages/dotnet-setversion/1.0.3-issue-5-0008
I think you should still be able to install unlisted packages though if you specify the exact version.
from dotnet-setversion.
This doesn't work yet because the task still doesn't get resolved correctly by the dotnet custom beta build step. I've raised an issue at microsoft/azure-pipelines-tasks#6249
from dotnet-setversion.
Yeah I'm not sure if you can do that unless you add the actual dotnet-setversion
executable to a directory under $PATH, like /usr/local/bin
on *nix or C:\Program Files\
on Windows. I'm basing that off of this.
from dotnet-setversion.
I think this is where I'm at. My scenario falls in a gap here. The setversion CLI is developed to be a project specific CLI. The dotnet VSTS build step is designed to execute globally installed CLI packages. Does that sound right?
from dotnet-setversion.
Yeah but these changes make it so that the setversion CLI can be used globally. I think it's just a matter of finding a way to install it globally during VSTS builds, if that's possible.
from dotnet-setversion.
Going to close this for housekeeping. Let me know if you want it re-opened. I think someone else is working on a feature branch that might turn this into a global tool anyway.
from dotnet-setversion.
Related Issues (20)
- CI build hangs indefinitely HOT 4
- Error on Build HOT 2
- Support for .NET Core 3.1 HOT 2
- No problems here, just thanks
- trim trailing newline HOT 2
- AssemblyVersion and FileVersion are not updated. HOT 3
- Support for .NET 5.0
- Support to modify VersionPrefix and automatically increment a specified portion of the semantic version HOT 2
- Support for .NET 6.0 HOT 2
- Working with older project formats HOT 2
- Error when running HOT 4
- Support for .NET 7.0 HOT 3
- Support for .NET 8 HOT 5
- Doesn't work for dotnetcore 2.0 HOT 4
- Drop support for .NET Core 2.1, .NET Core 3.1, and .NET 5 HOT 1
- Latest dotnet2.0-sdk container doesn't work with setversion HOT 4
- TeamCity integration? HOT 3
- Does not handle multiple <PropertyGroup> tags HOT 1
- Unexpected behaviour in a directory with multiple csproj files HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet-setversion.