Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to set IsPreRelease in a .NET assembly?

The FileVersionInfo class has an IsPreRelease property.

Is there any way through AssemblyInfo or something else in my .NET assembly project to get that property to return true in the resulting .dll file?

like image 466
Jaykul Avatar asked Jul 15 '12 03:07

Jaykul


People also ask

How do I mark a NuGet package as a prerelease?

Pre-release versions are then denoted by appending a hyphen and a string after the patch number. Technically speaking, you can use any string after the hyphen and NuGet will treat the package as pre-release.

How do I create a Nupkg?

Run the pack command Select Build > Configuration Manager, and then set the Active solution configuration to Release. Select the AppLogger project in Solution Explorer, and then select Build > Pack. Visual Studio builds the project and creates the . nupkg file.

Does NuGet use SemVer?

NuGet 4.3. 0+ supports SemVer 2.0. 0, which supports pre-release numbers with dot notation, as in 1.0.


1 Answers

If you specifically need it in your project/solution, then the classic path is to create a Resource Script (.rc) file. This is a homely, grungy format, but doable. The downside is that you need to get all the correct settings to start with, then maintain them manually thereafter.

The easiest path, if you're okay with manual clicking after the build, is using ResEdit (or equivalent), and adding VS_FF_PRERELEASE into the FileFlags field.

Note, the FileFlagsMask field should already have the prerelease flag or'ed together with a batch of others--that's necessary, but not sufficient.

Also, you can use resedit to generate a starter .rc file pretty simply:

resedit -convert my.dll my.rc

If you need an auto-with-build process, then there may well be a utility out there that can make that targeted modification on the command line, and then you could add that as a post-build step on the project that builds the .dll in question.

Good luck!

like image 104
Coleoid Avatar answered Oct 05 '22 19:10

Coleoid