简体   繁体   English

Visual Studio通用project.json

[英]Visual Studio common project.json

I have a question to the new Microsoft Projects in Visual studio 2015. At the moment each project has now is own project.json file where you can define Version author url etc. My question is now is it possible that we can have some of the Properties in a common.json file and share this offer all Solutions/Projects? 我对Visual Studio 2015中的新Microsoft Projects有一个疑问。目前,每个项目现在都有自己的project.json文件,您可以在其中定义版本作者url等。我的问题是,现在我们是否可以拥有一些在common.json文件中共享属性并提供所有解决方案/项目?

<Source Folder>
    Common.json
    <Solution1>
        <Project1>
            <Project1.json>
        <Project2>
            <Project2.json>
    <Solution2>
        <Project3>
            <Project3.json>
        <Project4>
            <Project4.json>

In older Visual Studio Version we solved this with a GlobalAssemblyInfo file we linked into the Project. 在较早的Visual Studio版本中,我们通过链接到项目中的GlobalAssemblyInfo文件解决了该问题。 We need this because we a couple 100 Projects which have the same Version number. 我们需要这样做是因为我们有100个具有相同版本号的项目。 Thanks for your ideas Michael 谢谢你的想法迈克尔

First, I don't think the properties defined in the project.json influence the assembly attributes that are defined in your AssemblyInfo.cs (and the global equivalent, in your case GlobalAssemblyInfo.cs ). 首先,我不认为在定义的属性project.json影响在中定义的组件属性AssemblyInfo.cs (和同等学历,你的情况GlobalAssemblyInfo.cs )。 They are used for the metadata in the resulting NuGet package. 它们用于生成的NuGet包中的元数据。 Currently (and not sure if this is going to change but I don't think so) there isn't a way to include another file in a project.json file like you're describing. 当前(并且不确定是否会改变,但我认为不是),无法像您所描述的那样在project.json文件中包含另一个文件。

To accomplish the same goal of having a global file that applies common assembly attributes, you have to edit each project.json file to include your common file. 为了实现拥有应用通用程序集属性的全局文件的相同目标,您必须编辑每个project.json文件以包括您的通用文件。 In your case, you would want to change your project.json so it looks like: 在您的情况下,您需要更改project.json ,使其类似于:

{
   "compileFiles": [ "..\..\GlobalAssemblyInfo.cs" ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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