csproj

How to use a custom attribute on an assembly in .NET Core 1.1

五迷三道 提交于 2019-12-04 03:26:28
While I found this post regarding retrieving a custom attribute on an assembly, I am unsure on how to add a custom attribute to an assembly in .NET Core 1.1. In .NET Framework, I would have done something like: [assembly: AdditionalLocation(@"..\ReadFromHere")] But my netcore1.1 projects in Visual Studio do not have an AssemblyInfo.cs. Where would I declare a custom attribute for an assembly? Is there something I can put in the .csproj file? You can always create a new AssemblyInfo.cs file or any other .cs file to do the same. However you can also use the new auto-generated assembly info

Visual Studio keeps adding property to my csproj. Why?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 02:59:18
问题 I'm using Visual Studio 2012 RC to work with my C# solution. All my configuration-specific settings are stored within a single .props file which is then included by all my .csproj files. Yet VS insists on putting this right in front of the include: <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> <IntermediateOutputPath>C:\Users\xyz\AppData\Local\Temp\vs855E.tmp\Debug\</IntermediateOutputPath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)

Your project does not reference “.NETFramework,Version=v4.6.2” framework. Add a reference to “.NETFramework,Version=v4.6.2” in the “TargetFrameworks”

别来无恙 提交于 2019-12-03 22:02:39
I can't run my unit tests. I have the next error: Your project does not reference ".NETFramework,Version=v4.6.2" framework. Add a reference to ".NETFramework,Version=v4.6.2" in the "TargetFrameworks" property of your project file and then re-run NuGet restore. In app.config : <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/> </startup> In Project > Properties > Application > TargetFramework (.NET Framework 4.6.2) How can I fix it? Please make the next steps Clean solution Clean folder "packages" Delete folder "bin" Delete folder "obj" I up-voted Larissa but I

How to share source code via nuget packages for use in .NET Core projects

Deadly 提交于 2019-12-03 21:40:02
问题 I want to make small pieces of source code (e.g. helper classes) available for use in .NET Core projects (.csproj). At this point I packaged the source code with NuGet in many different ways according to different blog posts and the official nuget docs. I used a nuspec file to control where my source files will end up in the nuget package, e.g.: <files> <file src="*.cs" target="content/LruCache" /> <file src="*.cs" target="contentFiles/cs/any/LruCache" /> </files> I did not include any

csproj: how to get all resources?

﹥>﹥吖頭↗ 提交于 2019-12-03 21:33:41
How to get all recources,wich copies to created binary? I think that it is all elements like this (has CopyToOutputDirectory tag): <ItemGroup> <None Include="Configs\Config.config"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> </ItemGroup> and like this: <ItemGroup> <Resource Include="Resources\Icons\icon4.png" /> </ItemGroup> <ItemGroup> <Resource Include="Resources\Icons\icon5.png" /> </ItemGroup> <ItemGroup> <Resource Include="Resources\Icons\icon6.png" /> </ItemGroup> <ItemGroup> <Resource Include="icon7.ico" /> </ItemGroup> <ItemGroup> <Resource Include="Resources\Icons

The value “” of the “Project” attribute in element <Import> is invalid. vs2012

断了今生、忘了曾经 提交于 2019-12-03 17:41:13
问题 I'm getting the following error while trying to load some projects in visual studio 2012: G:\path\project.csproj : error : The value "" of the "Project" attribute in element <Import> is invalid. Parameter "path" cannot have zero length. I'm trying this with a fresh start on the machine after a svn checkout. These projects can be loaded on other machines correctly. Can some one help me out with this one? Google didn't give me the answer, I hope SO will. EDIT This is the relevant part of the

How to Set AutoGenerateBindingRedirects in Visual Studio for Mac?

与世无争的帅哥 提交于 2019-12-03 16:17:58
I'm currently working on a Xamarin.Forms project named ABCD, using macOS Sierra v10.12.6 and Visual Studio (VS) for Mac v7.3.2 (the set up steps are detailed here ). Having successfully set that up, I continue as follows: Right-clicking the main project folder, I select Options . Under Build , in General , under Target Framework : .NET Portable: PCL 4.5 - Profile111 has been automatically selected for me. I switch this to the option right above it: .NET Standard Platform: netstandard1.5 ; then select OK . After switching this framework, I rebuild the project. After the rebuild, a warning

How to make Sonarqube exclude a .NET (C#) project from coverage measures

一个人想着一个人 提交于 2019-12-03 13:39:45
Sonarqube allows for individual files to be excluded from code coverage by adding patterns in the sonar.coverage.exclusions key. This can be done on a project level by adding them in the UI and even in a .csproj file by specifying a SonarQubeSetting element. I.e. <SonarQubeSetting Include="sonar.coverage.exclusions"> <Value>**/*.cs</Value> </SonarQubeSetting> However, both of these approaches don't seem to work. Playing with the patterns, as specified in the SonarQube documentation doesn't provide the desired result. I'm also aware of the existence of the SonarQubeExclude MSBuild property, but

Cannot find command 'dotnet ef'?

血红的双手。 提交于 2019-12-03 09:52:28
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 WebApiServerApp]$ dotnet tool list -g Package Id Version Commands -----------------------------------------------

Do I need AssemblyInfo while working with .NET Core?

ⅰ亾dé卋堺 提交于 2019-12-03 09:19:13
问题 Previously, AssemblyInfo.cs file was autocreated by Visual Studio to contain assembly-wide attributes, like AssemblyVersion, AssemblyName and so on. In .NET Core and ASP.NET Core, project.json is responsible for holding most of that information. So the question is: do I need to mark my assemblies with that attributes anymore? What traps can I get in if I will not mark assembly with that attributes? 回答1: project.json has replaced the AssemblyInfo . AssemblyVersionAttribute is replaced by