Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Create a nuget package that adds a build configuration

$
0
0

How can I create a custom nuget package in which a new build configuration "TestConfiguration" is defined and will be added in the project and solution file.

In the solution file I want to add the following:

    GlobalSection(SolutionConfigurationPlatforms) = preSolution        Debug|Any CPU = Debug|Any CPU        Release|Any CPU = Release|Any CPU        TestConfiguration|Any CPU = TestConfiguration|Any CPU    EndGlobalSection    GlobalSection(ProjectConfigurationPlatforms) = postSolution        {4C75633E-8F7C-4715-8F9E-0003A3F11FF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU        {4C75633E-8F7C-4715-8F9E-0003A3F11FF8}.Debug|Any CPU.Build.0 = Debug|Any CPU        {4C75633E-8F7C-4715-8F9E-0003A3F11FF8}.Release|Any CPU.ActiveCfg = Release|Any CPU        {4C75633E-8F7C-4715-8F9E-0003A3F11FF8}.Release|Any CPU.Build.0 = Release|Any CPU        {4C75633E-8F7C-4715-8F9E-0003A3F11FF8}.TestConfiguration|Any CPU.ActiveCfg = TestConfiguration|Any CPU        {4C75633E-8F7C-4715-8F9E-0003A3F11FF8}.TestConfiguration|Any CPU.Build.0 = TestConfiguration|Any CPU    EndGlobalSection

In the project file the following should be added (this already works with the .nupkg below):

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'TestConfiguration|AnyCPU'"><DebugSymbols>true</DebugSymbols><OutputPath>bin\TestConfiguration\</OutputPath><DefineConstants>DEBUG;TRACE</DefineConstants><DebugType>full</DebugType><PlatformTarget>AnyCPU</PlatformTarget><LangVersion>7.3</LangVersion><ErrorReport>prompt</ErrorReport><Prefer32Bit>true</Prefer32Bit></PropertyGroup>

My custum NugetPackage "MyPackage.nupkg" has the following content:

  • build (folder)
    • MyPackage.targets
<?xml version="1.0" encoding="utf-8"?><Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'TestConfiguration|AnyCPU'"><DebugSymbols>true</DebugSymbols><OutputPath>bin\TestConfiguration\</OutputPath><DefineConstants>DEBUG;TRACE</DefineConstants><DebugType>full</DebugType><PlatformTarget>AnyCPU</PlatformTarget><LangVersion>7.3</LangVersion><ErrorReport>prompt</ErrorReport><Prefer32Bit>true</Prefer32Bit></PropertyGroup></Project>

Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>