简体   繁体   中英

Error CS0246: The type or namespace name 'AssemblyFileVersion' could not be found

在此输入图像描述 Properties\\AssemblyInfo.cs(41,12): error CS0246: The type or namespace name 'AssemblyFileVersion' could not be found.

I'm getting this error when I use TFS build agent but don't have this problem with building using the .csproj from studio.

Is there anything I am missing? My assemblyinfo file looks like so:

// --------------------------------------------------------------------------------------------------------------------

using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MyLibrary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("My Compamy")]
[assembly: AssemblyProduct("MyLibrary")]
[assembly: AssemblyCopyright("Copyright © x 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("09634b91-c3b1-45da-88a8-dfa7cd7950f5")]

// 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 Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.13231.2")]

Please try this : Put all those libraries on your build machine. Use NuGet to manage the packages and configure it to pull down the libraries that are missing. You may either want to add them manually.

I worked it out in the end. I had a NuGet versioning package in TFS which was checking out the AssemblyInfo class and re-adding the AssemblyFileVersion attribute. I turned this feature off as the attribute is not supported by the .NET CF.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM