msbuild

Exclude whole files based on configuration from build in VS2008

空扰寡人 提交于 2019-12-22 04:35:28
问题 I have three different configurations on my project, all three do not require all files to be build into the application. Actually I'd prefer if I could exclude those files from the build, which would make my application a little more lightweight. What I'm looking for is #if MYCONFIG or #if DEBUG statement but for files. I've already read that this can be accomplished by manually editing the csproj file, but I can't find that anymore...and are there other ways? 回答1: There are two different

Conditional per TargetFramework in MsBuild 15

喜夏-厌秋 提交于 2019-12-22 04:32:56
问题 With the new MsBuild version it's really easy to target multiple frameworks and framework versions in .csproj project: <TargetFrameworks>net40;net45;net461;netcoreapp1.1</TargetFrameworks> Now, how do I get a constant defined for each of them so that I can have certain code only be part of e.g. netcoreapp1.1 pass and not full framework compilation? I'd like to be able to add a preprocessor directive like this one: #if NET_CORE // some code #endif And the same for full .NET Framework and

MSBuild task to execute an external MSBuild file

自古美人都是妖i 提交于 2019-12-22 04:32:29
问题 I'm trying to set up a MSBuild file which will invoke another MSBuild file and I'm wondering what's the best way to achieve this. We're using it in the scenario of where a build server downloads a MSBuild file which then depending on the parameters it'll execute the appropriate 2nd file. I know I can just use the <Exec Command="msbuild.exe ..." /> task, but that seems to be a bit of a hacky way to do it. Is there an easier way to use MSBuild to execute another MSBuild file? 回答1: You can use

Build errors of missing packages in Visual Studio Online (2015 version)

点点圈 提交于 2019-12-22 04:24:17
问题 I'm getting the following message when I trigger a build on check-in to Visual Studio Online. Locally it compiles and deploys just fine. packages\Microsoft.Net.Compilers.1.0.0\tools\Microsoft.CSharp.Core.targets (67, 5) To be more precise, this is the problem being described. The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\a\1\s\packages\Microsoft.Net.Compilers.1.0.0\build..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly

specflow fails when trying to generate test execution report

我的未来我决定 提交于 2019-12-22 04:18:14
问题 I've got a project that's using SpecFlow, NUnit and Coypu to do acceptance tests on a web application. I've got the project building OK via Jenkins on a build server. Jenkins calls a psake script which runs msbuild on the specs project, then the script calls nunit-console to run the specs/tests, and then I want to generate a report from SpecFlow. Framework "4.0" task Default -depends RunSpecs task BuildSpecs { $env:EnableNuGetPackageRestore = "true" msbuild /t:Rebuild ReturnsPortal.Specs

MSBuild custom task “Hello World” walkthrough

眉间皱痕 提交于 2019-12-22 04:01:41
问题 Can someone write (or link to) a walkthrough that explains exactly how to create a custom MSBuild task and run it during a build? I'm looking for a custom task that inherits from Microsoft.Build.Utilities.Task and does only this: public override bool Execute() { Log.LogMessage("Hello world!"); return true; } (I've been working on this for hours and keep getting the "The [whatever] task was not found. Check the following" message. I think I must be missing an essential step somewhere. If there

Using Studio's “Custom Tool” in MSBuild

元气小坏坏 提交于 2019-12-22 03:49:02
问题 I've got a "Custom Tool" for Visual Studio to munge some template files into code. For consistency and portability I'd like to be able to run this template processor from MSBuild when building outside of Visual Studio. Visual Studio creates the following snippets for the files: <!-- the template --> <None Include="Template.in"> <Generator>Template Processor</Generator> <LastGenOutput>Template.in.Designer.cs</LastGenOutput> </None> <!-- generated file --> <Compile Include="Template.in.Designer

Visual Studio build problem with “ReflectionOnlyAssemblyResolve event”

风流意气都作罢 提交于 2019-12-22 03:45:02
问题 I have a Visual Studio 2010 project that is targeted to .NET Framework 3.5. The project builds fine from Visual Studio, but when I try to compile it from the command line or from TeamCity I get the following build error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFX.targets(269,9): error MC1000: Unknown build error, 'Cannot resolve dependency to assembly 'Microsoft.Windows.Design.Extensibility, Version=4.0.0.0, Culture=neutral, PublicKey Token=b03f5f7f11d50a3a' because it has

“An assembly with the same simple name has already been imported” error without duplicate reference

随声附和 提交于 2019-12-22 03:18:14
问题 I'm getting the following error: error CS1704: An assembly with the same simple name 'Interop.xxx.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side. Everything I've seen says that I am referencing two assemblies with the same name and I need to remove one of them. However, I've checked and I'm only referencing it once. This also only happens when I'm using msbuild to build from the

how to set MSBuild VC++ Directories

假装没事ソ 提交于 2019-12-22 03:07:08
问题 I have a solution of mixed VB.NET and C++ projects. When using Visual Studio 2005 you can set the "Tools->Option->Projects and Solutions->VC++ Directories" to help the compiler find your include files. When building the same solution with MSBuild I don't see how to pass these settings. The C++ won't compile without this path specified. When building this solution form Visual Studio it build perfectly. What is the way to pass this path for MSBUild? Edit: Looks like MSBuild doesn't pass the