assemblyinfo

C# AssemblyFileVersion usage within a program

拜拜、爱过 提交于 2019-11-28 06:15:30
I'm working on a program, and I'm trying to display the assembly FILE version public static string Version { get { Assembly asm = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location); return String.Format("{0}.{1}", fvi.FileMajorPart, fvi.FileMinorPart); } } At the moment, this only returns the first two version numbers in the "AssemblyVersion", not "AssemblyFileVersion." I'd really like to just reference the AssemblyFileVersion rather than store an internal variable called "Version" that I have to update both this and the assembly version...

Getting assembly name

雨燕双飞 提交于 2019-11-28 03:07:11
C#'s exception class has a source property which is set to the name of the assembly by default. Is there another way to get this exact string (without parsing a different string)? I have tried the following: catch(Exception e) { string str = e.Source; //"EPA" - what I want str = System.Reflection.Assembly.GetExecutingAssembly().FullName; //"EPA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" str = typeof(Program).FullName; //"EPA.Program" str = typeof(Program).Assembly.FullName; //"EPA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" str = typeof(Program).Assembly.ToString(); //

Access Version from AssemblyInfo in MSBuild

﹥>﹥吖頭↗ 提交于 2019-11-27 23:50:48
问题 I am trying to create/push nuget package through visual studio build process as explained here. Building package is easy: <Exec WorkingDirectory="$(ProjectDir)" Command="$(NuGetApp) pack $(ProjectFile) -OutputDirectory $(Deploy) -Verbose -Prop Configuration=Release"/> I see .nupkg file in $(Deploy) folder. But to be able to push it, I need $(AssemblyVersion) to use it in : <Exec Command="$(NuGetApp) push $(ProjectName)$(AssemblyVersion) -s $(NugetServer) $(NugetKey)" /> I tried XMLRead to

Get minor and major version from MSBUILD script

本秂侑毒 提交于 2019-11-27 21:24:09
问题 I'm using Msbuild to compile and generate .zip files and installers and I need the version number of my assembyInfo. I'm using this code. <Target Name="getversion"> <GetAssemblyIdentity AssemblyFiles="$(BuildDir)\myprogram.exe"> <Output TaskParameter="Assemblies" ItemName="fooAssemblyInfo"/> </GetAssemblyIdentity> <Message Text="Version = %(fooAssemblyInfo.Version)"/> </Target> But this returns Version = 2.0.0.29110, I need just the minor and major version. Is there any way to read the

How can I change AssemblyProduct, AssemblyTitle using MSBuild?

无人久伴 提交于 2019-11-27 11:57:46
I have an MSBuild script which compiles my existing solution but I'd like to change some properties of one of the projects within the solution at compile-time, including but not limited to AssemblyProduct and AssemblyTitle. Here's a snippet of my build script: <Target Name="Compile" > <MSBuild Projects="..\MySolution.sln" Properties="Configuration=MyReleaseConfig;Platform=x86" /> </Target> I've got one main executable and several DLLs that are compiled. I am aware of the MSBuild Extension Pack and I suspect it might help me to get to where I need to be, although I'm not sure how to proceed.

Assembly Versioning using CruiseControl.net

烂漫一生 提交于 2019-11-27 11:21:31
问题 I have setup CruiseControl.net for a bunch of my projects which are related. As a result a single project tag in CruiseControl has multiple SVN checkouts and then a bunch of msbuild tasks compile all the individual sln files. I need to update the assembly version of all the solutions when this build is being done. However, since i'm not using nant and not using MSBuild proj files, I am unsure on how to get this. I wonder if I'm missing something obvious. I just need a solution which can be

What are the best practices for using Assembly Attributes?

泄露秘密 提交于 2019-11-27 08:56:11
问题 I have a solution with multiple project. I am trying to optimize AssemblyInfo.cs files by linking one solution wide assembly info file. What are the best practices for doing this? Which attributes should be in solution wide file and which are project/assembly specific? Edit: If you are interested there is a follow up question What are differences between AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion? 回答1: We're using a global file called GlobalAssemblyInfo.cs and a

Details of Assembly version

对着背影说爱祢 提交于 2019-11-27 03:25:46
问题 we will find Assembly version from Assembly.cs in every library. [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] My question is what is 1.0.0.0 meant by this? Thanks 回答1: As stated in the file itself: // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown

C# Project Global AssemblyInfo

做~自己de王妃 提交于 2019-11-27 03:17:19
问题 NET 3.5 solution with multiple projects in it. Is there a way I can create a "Global" AssemblyInfo.cs in which all the project AssemblyInfo.cs can reference from? 回答1: Create AssemblyInfoInc.cs somewhere in the root of your solution, add global attributes there and add as link to each project. File Add Dialog: 来源: https://stackoverflow.com/questions/2732155/c-sharp-project-global-assemblyinfo

C# AssemblyFileVersion usage within a program

喜夏-厌秋 提交于 2019-11-27 01:14:49
问题 I'm working on a program, and I'm trying to display the assembly FILE version public static string Version { get { Assembly asm = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location); return String.Format("{0}.{1}", fvi.FileMajorPart, fvi.FileMinorPart); } } At the moment, this only returns the first two version numbers in the "AssemblyVersion", not "AssemblyFileVersion." I'd really like to just reference the AssemblyFileVersion rather than store