Changing the name of the output assembly and package using dnx/.net core

孤者浪人 提交于 2019-12-06 18:43:32

问题


I have a project which exists in a directory named Oracle and I would like the artifacts created to be called MyCompany.MyApp.Oracle instead of Oracle, what are my options for changing the output assembly name and nuget package name outside of changing the name of the directory?

  • I currently have a MyCompany.MyApp.Oracle.xproj next to my project.json file
  • I've also tried setting <AssemblyName>MyCompany.MyApp.Oracle</AssemblyName> in the xproj file but that didn't work
  • I've also tried setting {"id":"MyCompany.MyApp.Oracle"} in project.json and still no luck

回答1:


Based on comment of @Victor Hurdugaci

"buildOptions": {
    "outputName": "Some.Specific.Assembly.Name"
},

You need to put it inside project.json file. It will produce output with name: Some.Specific.Assembly.Name.dll




回答2:


Later edit: this answer was applicable to the pre-dotnet releases (dnx). Now it's possible to change the package name.

Old answer: The only way to change the package name is by changing the folder name.




回答3:


From .NET Core 1.1 on, which uses csproj instead of package.json, you should use the <AssemblyName> configuration.

Example of x.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <AssemblyName>Name your assembly here</AssemblyName>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>

</Project>


来源:https://stackoverflow.com/questions/32994365/changing-the-name-of-the-output-assembly-and-package-using-dnx-net-core

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!