csproj

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

时光毁灭记忆、已成空白 提交于 2019-11-29 06:19:12
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="Resources\*" /> <EmbeddedResource Include="..\..\..\Demo\*.cs" Link="Resources\" /> The first two only create

MS-Build BeforeBuild not firing

戏子无情 提交于 2019-11-29 06:01:16
I'm customising a .csproj project to run some custom tasks before the main build. However, I can't get the tasks to execute at all. I uncommented the <Target Name="BeforeBuild" /> element in the .csproj file and added a simple Message task, but when I build, the message doesn't appear in my output, so it seems the task isn't running. So this fragment does not output the message; Listing 1: No Message Appears <Target Name="BeforeBuild"> <Message Text="About to build ORM layer" Importance="normal" /> </Target> However, if I screw with some of the attributes, I can get the .csproj to fail to

Build errors when multi-targeting in csproj file

你说的曾经没有我的故事 提交于 2019-11-29 05:32:09
I'm trying to build a class library that multi-targets both .NET 4.5.1 and .NET Standard 1.3. According to the documentation , I should be able to do this: <PropertyGroup> <TargetFrameworks>net451;netstandard1.3</TargetFrameworks> </PropertyGroup> However, when I try to build, I get these odd errors: Cannot infer TargetFrameworkIdentifier and/or TargetFrameworkVersion from TargetFramework='net451'. They must be specified explicitly. MSB3645 .NET Framework v3.5 Service Pack 1 was not found. In order to target ".NETFramework,Version=v1.3", .NET Framework v3.5 Service Pack 1 or later must be

Cannot find command 'dotnet ef'?

佐手、 提交于 2019-11-29 05:17:41
问题 I am using .NET core 2.0 on Arch VScode and trying to get EF tools to work but I keep getting that error 'cannot find command dotnet ef'. I've just about looked everywhere and none of the suggestions worked. So if you can please help that would be much appreciated. The result of running 'dotnet ef' [wasiim@wasiim-PC WebApiServerApp]$ dotnet ef --help Cannot find command 'dotnet ef', please run the following command to install dotnet tool install --global dotnet-ef [wasiim@wasiim-PC

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

心已入冬 提交于 2019-11-29 04:54:04
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.WriteLine(sub); } } } I want to test both the program one by one, but when I do "dotnet run" It fails

Visual Studio 2017 csproj core file exclusion

ぐ巨炮叔叔 提交于 2019-11-29 02:26:01
问题 I've migrated xproj core projects to csproj . All is working well, however I still have issues with publish configuration. Based on documentation: https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json-to-csproj I should be able to exclude files during publish. I've added following lines to the f <None Include="*.json" CopyToPublishDirectory="Never" /> <None Include="wwwroot\**\*.map;wwwroot\**\*.less;*.pdb" CopyToPublishDirectory="Never" /> <None Include="wwwroot\**\*"

MsBuild copy file after build

試著忘記壹切 提交于 2019-11-29 01:15:00
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. 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\Debug (making it effectively an absolute path, like C:\bin\Debug ). Either use bin\Debug , or better yet use the

Modify programmatically csproj files

与世无争的帅哥 提交于 2019-11-28 22:00:17
I have source code of Entlib 5.0 and I need sign all assemblies using my own key (snk file). The easiest way would be to open the EnterpriseLibrary.2010 solution file in Visual Studio 2010 and then for each project select Properties->Signing and select Sign the Assembly and then select your key file. But I don't want to manually do that then I could write a script to manually edit the project files and insert the following at the end of the current list of PropertyGroups: <PropertyGroup> <SignAssembly>true</SignAssembly> </PropertyGroup> <PropertyGroup> <AssemblyOriginatorKeyFile>keyFile.snk<

Why missing <SccProjectName> in project file cause “The project file is not bound to source control”

廉价感情. 提交于 2019-11-28 20:17:57
I had a very annoying problem, I have found a solution, but I would like to ask you why it behaves like that... I am using Visual Studio 2012 with TFS 2012. Everything was fine, but one day I have spotted a problem. When I have added a new project to my solution, then I have always obtaining this message every time I have reopened the solution: This project file ... is not bound to source control, but the solution contains source control binding information for it. Do you want... Whatever I have done, I still have this message. In the File->Source Control->Advanced->Change Source Control...'

Can the new csproj file structure be used with a ASP.NET Framework project?

不羁岁月 提交于 2019-11-28 19:56:37
问题 The new .csproj format includes some significant improvements over the classic files, including tight integration with NuGet package management and significantly less-verbose structure. I want to gain these benefits whilst still using the .NET Framework 4.6 and ASP.NET (because my project depends on Umbraco which has yet to produce a .NET Core version). The biggest challenge would seem to be the debugging experience - an ASP.NET Core project expects to run a dotnet core application and set up