We've updated to VS2012 recently and also changed our PostSharp version to 3.0.26. Generally this combination works fine, but I get warnings for my unit test project such as
The module "MyModule.Fakes.dll" does not contain any aspect or other transformation. For improved build-time performance, consider disabling PostSharp for this module by setting the compilation symbol (aka constant) "SkipPostSharp" in your project or set the MSBuild property "SkipPostSharp=True".
Now usually I can disable this warning by changing the project settings accordingly (SkipPostSharp = True), but I've already done that for my MyProjectTest project containing the unit tests.
When I add <SkipPostSharp>True</SkipPostSharp> to my MyModule.Fakes file in the Fakes folder, the warning about PostSharp disappears, however, I get another error message:
The element "Fakes" in namespace "http://schemas.microsoft.com/fakes/2011/" has invalid child element "SkipPostSharp" in namespace "http://schemas.microsoft.com/fakes/2011/". List of possible elements expected: "StubGeneration, ShimGeneration, Compilation" in namespace "http://schemas.microsoft.com/fakes/2011".
Update
I also tried editing the fakes.xsd file and add an extra SkipPostSharp element, but a) this still isn't recognised as a valid element by Visual Studio and b) I'm not sure whether this would be the right approach anyway.
Any ideas how to get rid of these warnings?
You can specify additional properties for the project file Fakes will generate to build the fakes assembly by placing Property elements inside of the Compilation element at the end of the .FAKES file. Here is an example based on your description.
<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/">
<Assembly Name="MyModule"/>
<Compilation>
<Property Name="SkipPostSharp">True</Property>
</Compilation>
</Fakes>
Related
I have a cmake project that is part of some larger environment.
There are some cmake makros/functions that I have to use to set up my project.
At some point they add a compile flag:
TARGET_COMPILE_OPTIONS (${name} PUBLIC "$<$<CONFIG:Release>:/GL>")
however, i want to remove this flag afterwards because it causes some inconvenience in my project.
But there seems to be a bug in cmake:
I tried to to remove the flags from the INTERFACE_COMPILE_OPTIONS and COMPILE_OPTIONS (this is there target_compile_options adds the options according to cmake doku ).
message commands before and after the removal shows the success but the generated vcxproj file still contains the
<WholeProgramOptimization>true</WholeProgramOptimization>
in the <ItemDefinitionGroup><ClCompile> section.
So it seems that adding the /GL flags triggers some internal state change that can not be removed afterwards. (if i remove the addition of that flag in the macro I have to call, then the WholeProgramOptimization node is not added to the vcxproj)
Did I miss something?
I can just add a /GL- as an option but then I get a lot of D9025 warnings (override /GL with /GL-)
(tested with cmake 3.15 and 3.13)
It turns out, that the problem is that the cmake scripts I have to use sets the optimizer settings with PUBLIC as scope
TARGET_COMPILE_OPTIONS (${name} PUBLIC "$<$<CONFIG:Release>:/GL>")`
^^^^^^
Another dependency of my project uses the same function and gets this flag into its INTERFACE_COMPILE_OPTIONS and my project inherits this option without possibility to remove it.
The only way seems to be to get the common scripts fixed to use PRIVATE scope instead. This would be more logical, since its an internal target property that does not have any implications to the consumer.
For an Windows app, the option for the default language is found in Package.appxmanifest under the project. However, I do not know where to find the setting for a class library, because there is nothing like Package.appxmanifest under a class library project.
As a result, after I add Strings\zh-CN\Resources.resw and a few strings into a class library project, I get a few warnings, saying:
MakePRI : warning 0xdef00522: Resources found for language(s) 'zh-cn' but no resources found for default language(s): 'en-US'. Change the default language or qualify resources with the default language. http://go.microsoft.com/fwlink/?LinkId=231899
MakePRI : warning 0xdef01051: No default or neutral resource given for '...'. The application may throw an exception for certain user configurations when retrieving the resources.
No actual help from "fwlink" as usual.
Although nothing bad actually happens because the app gets zh-CN as its default language, it is still quite annoying and I would like to eliminate the warnings to turn on "treat warnings as errors".
Try to manually edit the <DefaultLanguage> in the csproj file. It's under the first <PropertyGroup> subtree.
Here is a snippet of the context where you should be able to find this tag:
<DefaultLanguage>zh-CN</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
When trying to debug a project which I have successfully debugged many times before and which compiles without incident, I'm now getting this error:
Visual Studio cannot start debugging because the debug target 'C:\Program Files (x86)\NUnit 2.6.2\bin\nunit.exe' is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly.
Looking at Program Files (x86), I can see that the reason VS can't find the file is that it doesn't exist. The version of NUnit it should be looking for is 2.6.4, not 2.6.2.
What I can't find, however, is any way to tell VS where to look. The OutputPath and AssemblyName properties referenced in the error message both seem unrelated to the issue, and there isn't any setting I can find that references NUnit at all, much less a particular version of it.
In following advice from some of the many other questions about this error, I have tried the following without success:
Cleaning and rebuilding the solution
Cleaning and rebuilding the individual projects within the solution
Looking at the project and solution files in a text editor (They all show NUnit 2.6.4)
Making sure the projects are all checked in the Configuration Manager
Checking the projects' debug properties
As stated above, neither the .sln files nor any of the .csproj files contained any reference to NUnit 2.6.2, but I finally found a reference to it in a .csproj.user file for one of the projects:
<StartProgram>C:\Program Files %28x86%29\NUnit 2.6.2\bin\nunit.exe</StartProgram>
Changing the version number there fixed the issue.
I'm trying to write a plugin for 3ds max, I went through the entire sdk installation process to the letter as described in the help files.
The problem I'm facing though is intellisence complaining about an invalid macro definition
"IntelliSense: command-line error: invalid macro definition:_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT =1"
I found the definition in project settigs -> c/c++ -> preprocessor definitions as inherited from parent or project default.
I tried disabling the inherited definitions and re-entered them, this time without the space between the name and the = and all works fine so I'm guessing its a typo on their part?
Anyway, I want to change the default project or whatever to not repeat it every time i start a new project. The project is created with a wizard which required me to copy over some files to appear and after which I had to enter the sdk path.
The files I copied are plain text with some fancy extensions and not much in them so I'm guessing the defaults are described in the sdk directory.. somewhere. Does anybody know what kind of a file I'm looking for?
EDIT: I found a file called root.vcxproj_template and it has a section for preprocessor definitions but all it contains is
<PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
and no mention of the broken one
EDIT2: in another part of the file there was a path to a property sheet (maxsdk\ProjectSettings\propertySheets\3dsmax.common.tools.settings) which included the faulty definition. I fixed it an no more complaints from VS.
_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT = 1 means that compiler should replace all old C run-time routines such as sprintf, strcpy, strtok with new versions such as strprintf_s, strcpy_s, strtok_s and similar. It goes in pair with following definition _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES = 1.
More you can find here: (MSDN) https://msdn.microsoft.com/en-us/library/ms175759.aspx. However I tried to use this but without success. It says that you can use this only for statically allocated buffers like char buffer[32], but compilers was still complaining bout unsecure strcpy.
How to pass custom build properties to csproj file ? My csproj is upgraded from VS2008 to VS2012.
Under MSBuild3, the build runs fine. I am able to access the custom properties. However, under on MSBuild4, I have the following warning.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets(316,9): warning MSB3052: The parameter to the compiler is invalid, '/define:MyCustomProp=WHATEVER' will be ignored. [C:\src\MyProj\MyProj.csproj]
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets(316,9): warning MSB3052: The parameter to the compiler is invalid, '/define:MyCustomPropTwo=WHATEVERTWO' will be ignored. [C:\src\MyProj\MyProj.csproj]
I am running this build under MSBuild 4 using script written in VS2008.
To pass a custom property to the msbuild commandline use the /p:PropertyName=PropertyValue command switch, this can be used multiple times. The PropertyName is then available within your msbuild script as $(PropertyName). See msbuild commandline reference
CSharp.targets file is an msbuild file, so you will have to lookup, which properties you want to pass.