Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

c# - Shared AssemblyInfo for uniform versioning across the solution

I've read about this technique: Shared assembly info in VS projects - JJameson's blog

Basically it means to create a SharedAssemblyInfo.cs with versioning information about the assembly, and adding this file as Link to all projects of the solution, so the actual file resides only in 1 location on disk.

My question deals with 2 scenarios:

  1. Existing solution that doesn't use this mechanism: Is there a way to easily add the ShareAssemblyInfo to all projects? (lets say i have a solution with 50 projects).

  2. When creating a new project, by default a new AssemblyInfo.cs is created. However i'd like to link automatically to the SharedAssemblyInfo as well.

Is there any solution for this? what is the common practice?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It is possible to link to a shared assembly info file in VS 2010. Ashish Jain has a good blog post about it: Sharing assembly version across projects in a solution.

After creating the shared assembly info file at the solution level, his instructions for linking to it from a project are:

  1. Right click on the project, in which you wish to add the Shared assembly file, and select Add -> Existing Item...

  2. Select the file “SharedAssemblyInfo.cs” from the solution folder.

  3. Instead of Add, click on the the arrow next to Add and click “Add as Link”

  4. Drag down the added linked file alongside AssemblyInfo.cs in the same folder.

  5. Repeat steps 1 – 4 for all projects for which you wish to add shared assembly file.

I've tried this and it works.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...