igorbek / codecontracts.msbuild Goto Github PK
View Code? Open in Web Editor NEWStandalone MSBuild integration of CodeContracts (by Microsoft Research)
License: MIT License
Standalone MSBuild integration of CodeContracts (by Microsoft Research)
License: MIT License
CodeContracts.MSBuild.1.12.0 (NuGet package).
I have simple test application. There're the following code in it:
public sealed class MyEnumToStringConerter<TEnum, TResources> : EnumConverter
{
public MyEnumToStringConerter(): base(typeof(TEnum)) { }
}
[TypeConverter(typeof(MyEnumToStringConerter<MyEnum, Resources>))]
public enum MyEnum
{
Alpha,
Beta,
Gamma
}
Resources
here are project resources.
This's the ccrewriter configuration:
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
<CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
<CodeContractsEmitXMLDocs>True</CodeContractsEmitXMLDocs>
<CodeContractsCacheAnalysisResults>True</CodeContractsCacheAnalysisResults>
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
<CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
<CodeContractsAssertsToContractsCheckBox>True</CodeContractsAssertsToContractsCheckBox>
<CodeContractsRedundantTests>True</CodeContractsRedundantTests>
<CodeContractsMissingPublicRequiresAsWarnings>True</CodeContractsMissingPublicRequiresAsWarnings>
<CodeContractsInferEnsuresAutoProperties>True</CodeContractsInferEnsuresAutoProperties>
<CodeContractsNecessaryEnsures>True</CodeContractsNecessaryEnsures>
<CodeContractsSuggestReadonly>True</CodeContractsSuggestReadonly>
<CodeContractsBeingOptimisticOnExternal>True</CodeContractsBeingOptimisticOnExternal>
On build I got next error:
Could not resolve type reference: [mscorlib]CCTest.MyEnum,CCTest.Properties.Resources.
Hey Igor,
maybe you could update your nuget package to the latest code contracts version?
%UserName%\.nuget\packages\codecontracts.msbuild\1.13.0-rc\Contracts\MsBuild\vCurrent\Microsoft.CodeContracts.targets(276,5):
error MSB4062:
The "Microsoft.Build.Tasks.GetFrameworkSdkPath" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
I tried to copy v15.0
to vCurrent
. No result
Do you have any plans to support Visual Studio 2019? VS2019 projects that reference the latest version of this NuGet package will not load, they produce an error in the Output window:
C:\solution-path\project-folder\project-name.csproj : error : The imported project "C:\solution-path\packages\CodeContracts.MSBuild.1.12.0\Contracts\MsBuild\vCurrent\Microsoft.CodeContracts.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. C:\solution-path\packages\CodeContracts.MSBuild.1.12.0\build\CodeContracts.MSBuild.targets
If there is a "quick" work around in the mean time I would appreciate that as well.
Thank you for making this package available, it has been very useful!
How to reproduce:
Boost
testUsed version: 1.12.0
This are the properties:
<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' and '$(Configuration)' == 'Debug' ">
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
<CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
<CodeContractsNonNullObligations>True</CodeContractsNonNullObligations>
<CodeContractsBoundsObligations>True</CodeContractsBoundsObligations>
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
<CodeContractsEnumObligations>False</CodeContractsEnumObligations>
<CodeContractsPointerObligations>False</CodeContractsPointerObligations>
<CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
<CodeContractsInferRequires>False</CodeContractsInferRequires>
<CodeContractsInferEnsures>False</CodeContractsInferEnsures>
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
<CodeContractsDisjunctiveRequires>False</CodeContractsDisjunctiveRequires>
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
<CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
<CodeContractsCustomRewriterAssembly />
<CodeContractsCustomRewriterClass />
<CodeContractsLibPaths />
<CodeContractsExtraRewriteOptions />
<CodeContractsExtraAnalysisOptions />
<CodeContractsBaseLineFile />
<CodeContractsCacheAnalysisResults>True</CodeContractsCacheAnalysisResults>
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
<CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
</PropertyGroup>
EDIT: I also created an issue in the original repository: microsoft/CodeContracts#502
Current package doesn't work with VS 2015 build, because of the error:
..\packages\CodeContracts.MSBuild.1.7.11202.1001\build\CodeContracts.MSBuild.targets(6,5): error MSB4019: The imported project "..\packages\CodeContracts.MSBuild.1.7.11202.1001\Contracts\MsBuild\v14.0\Microsoft.CodeContracts.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. [..\Sources\WNP.Listener\Core\Core.csproj]
The problem is that there is no v14.0 directory in the package. Please update the nugget package with latest MsBuild version.
Thank you for releasing this package.
What is the aim of this package and how it differs from the official one (https://github.com/Microsoft/CodeContracts) ? Wanting to build CC under VS2017. That package seems to solve this. How does it differ from this package - https://github.com/WiseTechGlobal/CodeContracts/releases ?
I just upload the github CodeContracts.MSBuild, runs my fallcreatorupdate app with some code contract in it but the debugger just fails when reaching some false assert.
How did I don wrong. Is there some other stuff to install in VS 2017?
Thanks
When in project used package Unity version="5.0.2" and CodeContracts.MSBuild version="1.12.0" then build error with output:
2> Reading assembly 'Unity.Abstractions' from 'C:\Work.NET\GitHub\NewPlatform.Flexberry.ORM.ODataService\packages\Unity.5.0.2\lib\net45\Unity.Abstractions.dll' resulted in errors.
2> Выдано исключение типа "System.OutOfMemoryException".
2>ccrewrite : error : Rewrite aborted due to metadata errors. Check output window
2> elapsed time: 1341,929ms
Need to write simple documentation in README
, such as:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.