开发者

AssemblyFileVersion causing build to fail

开发者 https://www.devze.com 2023-02-17 23:26 出处:网络
When I try to build my project, I get the following error: error : Unable to update the AssemblyFileVersion for c:\\builddir\\MyProject\\AssemblyInfo.cs: No stub entry for AssemblyF开发者_StackOverfl

When I try to build my project, I get the following error:

error : Unable to update the AssemblyFileVersion for c:\builddir\MyProject\AssemblyInfo.cs: No stub entry for AssemblyF开发者_StackOverflowileVersion was found in the AssemblyInfo file.

I found this article, which implies that a "stub" property is required. So, in my AssemblyInfo.cs, I tried to specify one:

[assembly: AssemblyFileVersion("1.0.0")]

However, it isn't recognised. I finally came across this article, which says that you can't use the AssemblyFileVersion property with the CF. The targets file used by the build script is also used for building other, non CF projects, and needs to update the FileVersion for them.

Is it possible to put something in the AssemblyInfo.cs file, the target file or the build script that stops this from being an issue?


Yes, something like this:

#if !(WindowsCE || PocketPC)
[assembly: AssemblyFileVersion("1.0.0")] 
#endif


If using the preprocessor in the manner described in the other answer doesn't work for you, consider putting the AssemblyFileVersion attribute into a separate source file, and conditionally including that source file in the project:

<Compile Include="AssemblyInfo.cs" />
<Compile Include="AssemblyInfo.AssemblyVersion.cs"
  Condition="
    '$(TargetPlatform)' == 'WindowsCE' OR
    '$(TargetPlatform)' == 'PocketPC'"
  />

I'm not sure if there is already a property you can use in the project file, or if you would need to declare your own (perhaps $(Platform) is used for this?)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号