csproj

Set a different ApplicationIcon for each build configuration

◇◆丶佛笑我妖孽 提交于 2019-12-19 09:48:42
问题 I'm trying to set a different Icon for each build configuration of my C# project (using VS 2010 pro). One config is for a different customer, thus that config should use a different icon. I'm not sure why this doesn't work in the csproj file: <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> ...blah... <ApplicationIcon>Images\RegularIcon.ico</ApplicationIcon> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Customer|AnyCPU'

How can I use BeforeBuild and AfterBuild targets with Visual Studio 2017?

主宰稳场 提交于 2019-12-18 14:48:24
问题 After upgrading to a csproj to use Visual Studio 2017 and Microsoft.NET.Sdk, my "BeforeBuild" and "AfterBuild" targets are no longer running. My file looks like this: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net46</TargetFramework> </PropertyGroup> <!-- my targets that don't run --> <Target Name="BeforeBuild"> <Message Text="Should run before build" Importance="High" /> </Target> <Target Name="AfterBuild"> <Message Text="Should run after build" Importance="High" /> <

Add a msbuild task that runs after building a .NET Core project in Visual Studio 2017 RC

亡梦爱人 提交于 2019-12-18 14:02:57
问题 Is there something like the AfterBuild Target in msbuild with .NET Core in Visual Studio 2017 RC? I tried to add the following snipped to the .csproj file, but it is not excuted during a build (Contrary to VS2015 where it does work). <Target Name="AfterBuild"> <Message Importance="High" Text="This is a test" /> </Target> Another interesting discovery: As I thought that the AfterBuild target might have been removed - running msbuild <project.csproj> /t:AfterBuild doesn't seem to call the added

Compiling a .vbproj or .csproj project file without Visual Studio

ぃ、小莉子 提交于 2019-12-18 12:47:52
问题 Is there a way to compile a .vbproj or .csproj project file directly, just like Visual Studio does? When you compile in Visual Studio, the "output" window shows the actual call to the compiler, which normally looks like: vbc.exe [bunch of options] [looooong list of .vb files] I would like to programatically call "something" that would take the .vbproj file and do whatever Visual Studio does to generate this long command line. I know i could parse the .vbproj myself and generate that command

How to conditionally reference a DLL based on a compilation symbol?

你。 提交于 2019-12-18 11:52:34
问题 Visual Studio 2013. I have an external DLL which I am referencing like this in the csproj file: <ItemGroup> <Reference Include="NameOfDll"> <HintPath>Path\To\Dll\NameOfDll.dll</HintPath> </Reference> I want this reference to function when a compiler symbol exists and to not function when that compiler symbol does not exist. (To address the first comment, below, let's say the compiler symbol is called Fred.) This question [ Conditional Reference ] made me think I could add an attribute called

How to conditionally reference a DLL based on a compilation symbol?

笑着哭i 提交于 2019-12-18 11:52:14
问题 Visual Studio 2013. I have an external DLL which I am referencing like this in the csproj file: <ItemGroup> <Reference Include="NameOfDll"> <HintPath>Path\To\Dll\NameOfDll.dll</HintPath> </Reference> I want this reference to function when a compiler symbol exists and to not function when that compiler symbol does not exist. (To address the first comment, below, let's say the compiler symbol is called Fred.) This question [ Conditional Reference ] made me think I could add an attribute called

.net core (csproj) global.json 'projects' equivalent

落爺英雄遲暮 提交于 2019-12-18 11:31:22
问题 With .net core (project.json) I used to switch between nuget packages and source code by adding the path to source code to the projects field in the global.json. After I did that it would add all the projects that it could find in that path that could replace the nuget packages I referenced. I used this feature alot because I have my own nuget packages that I use, but I want to test the changes in my other project before I publish. But once I switched to Sdk 1.0.0/VS 2017/csproj .net core

New .csproj format - How to specify entire directory as “linked file” to a subdirectory?

早过忘川 提交于 2019-12-18 04:01:53
问题 With the new .csproj format (as well as the old), it is possible to add files as linked outside of the project folder: <EmbeddedResource Include="..\..\..\Demo\Sample.cs" Link="Resources\Sample.cs" /> It is also possible to use a glob pattern to include multiple files: <EmbeddedResource Include="..\..\..\Demo\*.cs" /> But how do you combine the two? What I Tried <EmbeddedResource Include="..\..\..\Demo\*.cs" Link="Resources\*.cs" /> <EmbeddedResource Include="..\..\..\Demo\*.cs" Link=

Visual studio code: Program has more than one entry point defined?

穿精又带淫゛_ 提交于 2019-12-18 03:44:23
问题 I created C# project using visual studio code. This project contains two .cs files Addition.cs and Substraction.cs both files contains main() function, Both file contains two different programs. Code in Addition.cs file using System; namespace Example { class Addition { static void Main(string[] args) { int sum = 3 + 2; Console.WriteLine(sum); } } } Code in Substraction.cs file using System; namespace Example { class Substraction { static void Main(string[] args) { int sub = 3 - 2; Console

MsBuild copy file after build

丶灬走出姿态 提交于 2019-12-18 03:05:13
问题 I want to copy an xml file from the main directory to bin\Debug after building the project, but my solution doesn't work. I edited .csproj file and added: <Target Name="AfterBuild"> <Copy SourceFiles="Controllers.xml" DestinationFolder="\bin\Debug" ContinueOnError="true" /> </Target> What am I doing wrong? The build is successful. 回答1: Your destination folder is (most likely) wrong. If you specify it with a leading backslash, it is actually just a shortform for <current-drive-letter>\bin