├── .gitattributes
├── .github
└── workflows
│ └── dotnet.yml
├── .gitignore
├── LICENSE
├── README.md
├── src
├── IgnoresAccessChecksToGenerator.Tasks
│ ├── IgnoresAccessChecksToGenerator.Tasks.csproj
│ ├── PublicizeInternals.cs
│ └── build
│ │ ├── IgnoresAccessChecksToGenerator.props
│ │ └── IgnoresAccessChecksToGenerator.targets
└── IgnoresAccessChecksToGenerator.sln
└── test
├── IgnoresAccessChecksToGenerator.Test
├── IgnoresAccessChecksToGenerator.Test.csproj
├── IgnoresAccessChecksToGenerator.Test.sln
└── Program.cs
└── nuget.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | name: .NET
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 | branches: [ main ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v2
16 | - name: Setup .NET
17 | uses: actions/setup-dotnet@v1
18 | with:
19 | dotnet-version: 8.0.x
20 | - name: Restore dependencies
21 | run: dotnet restore src
22 | - name: Build
23 | run: dotnet build src --no-restore
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # MSTest test Results
33 | [Tt]est[Rr]esult*/
34 | [Bb]uild[Ll]og.*
35 |
36 | # NUNIT
37 | *.VisualState.xml
38 | TestResult.xml
39 |
40 | # Build Results of an ATL Project
41 | [Dd]ebugPS/
42 | [Rr]eleasePS/
43 | dlldata.c
44 |
45 | # .NET Core
46 | project.lock.json
47 | project.fragment.lock.json
48 | artifacts/
49 | **/Properties/launchSettings.json
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 | *.VC.db
88 | *.VC.VC.opendb
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 | *.sap
95 |
96 | # TFS 2012 Local Workspace
97 | $tf/
98 |
99 | # Guidance Automation Toolkit
100 | *.gpState
101 |
102 | # ReSharper is a .NET coding add-in
103 | _ReSharper*/
104 | *.[Rr]e[Ss]harper
105 | *.DotSettings.user
106 |
107 | # JustCode is a .NET coding add-in
108 | .JustCode
109 |
110 | # TeamCity is a build add-in
111 | _TeamCity*
112 |
113 | # DotCover is a Code Coverage Tool
114 | *.dotCover
115 |
116 | # Visual Studio code coverage results
117 | *.coverage
118 | *.coveragexml
119 |
120 | # NCrunch
121 | _NCrunch_*
122 | .*crunch*.local.xml
123 | nCrunchTemp_*
124 |
125 | # MightyMoose
126 | *.mm.*
127 | AutoTest.Net/
128 |
129 | # Web workbench (sass)
130 | .sass-cache/
131 |
132 | # Installshield output folder
133 | [Ee]xpress/
134 |
135 | # DocProject is a documentation generator add-in
136 | DocProject/buildhelp/
137 | DocProject/Help/*.HxT
138 | DocProject/Help/*.HxC
139 | DocProject/Help/*.hhc
140 | DocProject/Help/*.hhk
141 | DocProject/Help/*.hhp
142 | DocProject/Help/Html2
143 | DocProject/Help/html
144 |
145 | # Click-Once directory
146 | publish/
147 |
148 | # Publish Web Output
149 | *.[Pp]ublish.xml
150 | *.azurePubxml
151 | # TODO: Comment the next line if you want to checkin your web deploy settings
152 | # but database connection strings (with potential passwords) will be unencrypted
153 | *.pubxml
154 | *.publishproj
155 |
156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
157 | # checkin your Azure Web App publish settings, but sensitive information contained
158 | # in these scripts will be unencrypted
159 | PublishScripts/
160 |
161 | # NuGet Packages
162 | *.nupkg
163 | # The packages folder can be ignored because of Package Restore
164 | **/packages/*
165 | # except build/, which is used as an MSBuild target.
166 | !**/packages/build/
167 | # Uncomment if necessary however generally it will be regenerated when needed
168 | #!**/packages/repositories.config
169 | # NuGet v3's project.json files produces more ignorable files
170 | *.nuget.props
171 | *.nuget.targets
172 |
173 | # Microsoft Azure Build Output
174 | csx/
175 | *.build.csdef
176 |
177 | # Microsoft Azure Emulator
178 | ecf/
179 | rcf/
180 |
181 | # Windows Store app package directories and files
182 | AppPackages/
183 | BundleArtifacts/
184 | Package.StoreAssociation.xml
185 | _pkginfo.txt
186 |
187 | # Visual Studio cache files
188 | # files ending in .cache can be ignored
189 | *.[Cc]ache
190 | # but keep track of directories ending in .cache
191 | !*.[Cc]ache/
192 |
193 | # Others
194 | ClientBin/
195 | ~$*
196 | *~
197 | *.dbmdl
198 | *.dbproj.schemaview
199 | *.jfm
200 | *.pfx
201 | *.publishsettings
202 | orleans.codegen.cs
203 |
204 | # Since there are multiple workflows, uncomment next line to ignore bower_components
205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
206 | #bower_components/
207 |
208 | # RIA/Silverlight projects
209 | Generated_Code/
210 |
211 | # Backup & report files from converting an old project file
212 | # to a newer Visual Studio version. Backup files are not needed,
213 | # because we have git ;-)
214 | _UpgradeReport_Files/
215 | Backup*/
216 | UpgradeLog*.XML
217 | UpgradeLog*.htm
218 |
219 | # SQL Server files
220 | *.mdf
221 | *.ldf
222 | *.ndf
223 |
224 | # Business Intelligence projects
225 | *.rdl.data
226 | *.bim.layout
227 | *.bim_*.settings
228 |
229 | # Microsoft Fakes
230 | FakesAssemblies/
231 |
232 | # GhostDoc plugin setting file
233 | *.GhostDoc.xml
234 |
235 | # Node.js Tools for Visual Studio
236 | .ntvs_analysis.dat
237 | node_modules/
238 |
239 | # Typescript v1 declaration files
240 | typings/
241 |
242 | # Visual Studio 6 build log
243 | *.plg
244 |
245 | # Visual Studio 6 workspace options file
246 | *.opt
247 |
248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
249 | *.vbw
250 |
251 | # Visual Studio LightSwitch build output
252 | **/*.HTMLClient/GeneratedArtifacts
253 | **/*.DesktopClient/GeneratedArtifacts
254 | **/*.DesktopClient/ModelManifest.xml
255 | **/*.Server/GeneratedArtifacts
256 | **/*.Server/ModelManifest.xml
257 | _Pvt_Extensions
258 |
259 | # Paket dependency manager
260 | .paket/paket.exe
261 | paket-files/
262 |
263 | # FAKE - F# Make
264 | .fake/
265 |
266 | # JetBrains Rider
267 | .idea/
268 | *.sln.iml
269 |
270 | # CodeRush
271 | .cr/
272 |
273 | # Python Tools for Visual Studio (PTVS)
274 | __pycache__/
275 | *.pyc
276 |
277 | # Cake - Uncomment if you are using it
278 | # tools/**
279 | # !tools/packages.config
280 |
281 | # Telerik's JustMock configuration file
282 | *.jmconfig
283 |
284 | # BizTalk build output
285 | *.btp.cs
286 | *.btm.cs
287 | *.odx.cs
288 | *.xsd.cs
289 |
290 | *.binlog
291 |
292 | .DS_Store
293 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Eli Arbel
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # IgnoresAccessChecksTo Generator (MSBuild)
2 |
3 | [](https://www.nuget.org/packages/IgnoresAccessChecksToGenerator)
4 |
5 | The `IgnoresAccessChecksToAttribute` is the reverse of the `InternalsVisibleToAttribute` - it allows an assembly to declare assemblies whose internals would be visible to it. The attribute class isn't declared in the BCL but is recognized by the CLR (Desktop >= 4.6 and Core), i.e. you can declare it in your code and it would work.
6 |
7 | Since there's currently no compiler support for this attribute (I've [submitted a PR](https://github.com/dotnet/roslyn/pull/20870) to Roslyn), this package can be used as a workaround. It **generates reference assemblies where all the internal types & members become public**, and adds a C# file with the attribute and its instances.
8 |
9 | ## Usage
10 |
11 | Just add the package and define `IgnoresAccessChecksTo` items with the assemblies you need access to.
12 |
13 | ```xml
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | ```
28 |
--------------------------------------------------------------------------------
/src/IgnoresAccessChecksToGenerator.Tasks/IgnoresAccessChecksToGenerator.Tasks.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;net462
5 | latest
6 | IgnoresAccessChecksToGenerator
7 | 0.9.0
8 | true
9 | Eli Arbel
10 | https://github.com/aelij/IgnoresAccessChecksToGenerator
11 | MIT
12 | Generates IgnoresAccessChecksTo attributes and reference assemblies to allow compile-time access to internals
13 | IgnoresAccessChecksToGenerator IgnoresAccessChecksTo IgnoresAccessChecksToAttribute internals
14 | tools/$(TargetFramework)
15 | true
16 | $(TargetsForTfmSpecificBuildOutput);IncludePackageDependencies
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/IgnoresAccessChecksToGenerator.Tasks/PublicizeInternals.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using Microsoft.Build.Framework;
6 | using Microsoft.Build.Utilities;
7 | using Mono.Cecil;
8 |
9 | namespace IgnoresAccessChecksToGenerator.Tasks
10 | {
11 | public class PublicizeInternals : Task
12 | {
13 | private readonly AssemblyResolver _resolver = new AssemblyResolver();
14 |
15 | [Required]
16 | public ITaskItem[] SourceReferences { get; set; }
17 |
18 | [Required]
19 | public ITaskItem[] AssemblyNames { get; set; }
20 |
21 | [Required]
22 | public string IntermediateOutputPath { get; set; }
23 |
24 | [Required]
25 | public string GeneratedCodeFilePath { get; set; }
26 |
27 | public ITaskItem[] ExcludeTypeNames { get; set; }
28 |
29 | public override bool Execute()
30 | {
31 | if (SourceReferences == null) throw new ArgumentNullException(nameof(SourceReferences));
32 |
33 | var assemblyNames = new HashSet(AssemblyNames.Select(t => t.ItemSpec), StringComparer.OrdinalIgnoreCase);
34 |
35 | if (assemblyNames.Count == 0)
36 | {
37 | return true;
38 | }
39 |
40 | var excludedTypeNames = new HashSet(StringComparer.OrdinalIgnoreCase);
41 | if (ExcludeTypeNames != null)
42 | {
43 | excludedTypeNames = new HashSet(ExcludeTypeNames.Select(t => t.ItemSpec), StringComparer.OrdinalIgnoreCase);
44 | }
45 |
46 | var targetPath = IntermediateOutputPath;
47 | Directory.CreateDirectory(targetPath);
48 |
49 | GenerateAttributes(targetPath, assemblyNames);
50 |
51 | foreach (var assemblyPath in SourceReferences
52 | .Select(a => Path.GetDirectoryName(GetFullFilePath(targetPath, a.ItemSpec))))
53 | {
54 | _resolver.AddSearchDirectory(assemblyPath);
55 | }
56 |
57 | foreach (var assembly in SourceReferences)
58 | {
59 | var assemblyPath = GetFullFilePath(targetPath, assembly.ItemSpec);
60 | var assemblyName = Path.GetFileNameWithoutExtension(assemblyPath);
61 | if (assemblyNames.Contains(assemblyName))
62 | {
63 | var targetAssemblyPath = Path.Combine(targetPath, Path.GetFileName(assemblyPath));
64 |
65 | CreatePublicAssembly(assemblyPath, targetAssemblyPath, excludedTypeNames);
66 | Log.LogMessageFromText("Created publicized assembly at " + targetAssemblyPath, MessageImportance.Normal);
67 | }
68 | }
69 |
70 | return true;
71 | }
72 |
73 | private void GenerateAttributes(string path, IEnumerable assemblyNames)
74 | {
75 | var attributes = string.Join(Environment.NewLine,
76 | assemblyNames.Select(a => $@"[assembly: System.Runtime.CompilerServices.IgnoresAccessChecksTo(""{a}"")]"));
77 |
78 | var content = $$"""
79 | //------------------------------------------------------------------------------
80 | //
81 | // This code was generated by a tool.
82 | //
83 | // Changes to this file may cause incorrect behavior and will be lost if
84 | // the code is regenerated.
85 | //
86 | //------------------------------------------------------------------------------
87 |
88 | {{attributes}}
89 |
90 | namespace System.Runtime.CompilerServices
91 | {
92 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
93 | internal sealed class IgnoresAccessChecksToAttribute : Attribute
94 | {
95 | public IgnoresAccessChecksToAttribute(string assemblyName)
96 | {
97 | }
98 | }
99 | }
100 | """;
101 | File.WriteAllText(GeneratedCodeFilePath, content, System.Text.Encoding.UTF8);
102 |
103 | Log.LogMessageFromText("Generated IgnoresAccessChecksTo attributes", MessageImportance.Low);
104 | }
105 |
106 | private void CreatePublicAssembly(string source, string target, HashSet excludedTypeNames)
107 | {
108 | var assembly = AssemblyDefinition.ReadAssembly(source,
109 | new ReaderParameters { AssemblyResolver = _resolver });
110 |
111 | foreach (var module in assembly.Modules)
112 | {
113 | foreach (var type in module.GetTypes().Where(type => !excludedTypeNames.Contains(type.FullName)))
114 | {
115 | if (!type.IsNested && type.IsNotPublic)
116 | {
117 | type.IsPublic = true;
118 | }
119 | else if (type.IsNestedAssembly ||
120 | type.IsNestedFamilyOrAssembly ||
121 | type.IsNestedFamilyAndAssembly)
122 | {
123 | type.IsNestedPublic = true;
124 | }
125 |
126 | foreach (var field in type.Fields)
127 | {
128 | if (field.IsAssembly ||
129 | field.IsFamilyOrAssembly ||
130 | field.IsFamilyAndAssembly)
131 | {
132 | field.IsPublic = true;
133 | }
134 | }
135 |
136 | foreach (var method in type.Methods)
137 | {
138 | if (method.IsAssembly ||
139 | method.IsFamilyOrAssembly ||
140 | method.IsFamilyAndAssembly)
141 | {
142 | method.IsPublic = true;
143 | }
144 | }
145 | }
146 | }
147 |
148 | assembly.Write(target);
149 | // copy XML docs alongside the new assembly
150 | var xmlSource = Path.ChangeExtension(source, ".xml");
151 | if (File.Exists(xmlSource))
152 | {
153 | var xmlTarget = Path.ChangeExtension(target, ".xml");
154 | File.Copy(xmlSource, xmlTarget, overwrite: true);
155 | Log.LogMessageFromText($"Copied XML docs to {xmlTarget}", MessageImportance.Low);
156 | }
157 | }
158 |
159 | private string GetFullFilePath(string basePath, string path) =>
160 | Path.IsPathRooted(path) ? Path.GetFullPath(path) : Path.Combine(basePath, path);
161 |
162 | private class AssemblyResolver : IAssemblyResolver
163 | {
164 | private readonly HashSet _directories = new HashSet(StringComparer.OrdinalIgnoreCase);
165 |
166 | public void AddSearchDirectory(string directory)
167 | {
168 | _directories.Add(directory);
169 | }
170 |
171 | public AssemblyDefinition Resolve(AssemblyNameReference name)
172 | {
173 | return Resolve(name, new ReaderParameters());
174 | }
175 |
176 | public AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
177 | {
178 | var assembly = SearchDirectory(name, _directories, parameters);
179 | if (assembly != null)
180 | {
181 | return assembly;
182 | }
183 |
184 | throw new AssemblyResolutionException(name);
185 | }
186 |
187 | public void Dispose()
188 | {
189 | }
190 |
191 | private AssemblyDefinition SearchDirectory(AssemblyNameReference name, IEnumerable directories, ReaderParameters parameters)
192 | {
193 | var extensions = name.IsWindowsRuntime ? new[] { ".winmd", ".dll" } : new[] { ".exe", ".dll" };
194 | foreach (var directory in directories)
195 | {
196 | foreach (var extension in extensions)
197 | {
198 | var file = Path.Combine(directory, name.Name + extension);
199 | if (!File.Exists(file))
200 | continue;
201 | try
202 | {
203 | return GetAssembly(file, parameters);
204 | }
205 | catch (BadImageFormatException)
206 | {
207 | }
208 | }
209 | }
210 |
211 | return null;
212 | }
213 |
214 | private AssemblyDefinition GetAssembly(string file, ReaderParameters parameters)
215 | {
216 | if (parameters.AssemblyResolver == null)
217 | parameters.AssemblyResolver = this;
218 |
219 | return ModuleDefinition.ReadModule(file, parameters).Assembly;
220 | }
221 | }
222 | }
223 | }
--------------------------------------------------------------------------------
/src/IgnoresAccessChecksToGenerator.Tasks/build/IgnoresAccessChecksToGenerator.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 | false
9 |
10 |
11 | false
12 |
13 |
14 | false
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/IgnoresAccessChecksToGenerator.Tasks/build/IgnoresAccessChecksToGenerator.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_IACTG_TargetFramework Condition="'$(MSBuildRuntimeType)' == 'Core'">netstandard2.0
5 | <_IACTG_TargetFramework Condition="'$(MSBuildRuntimeType)' != 'Core'">net462
6 | <_IACTG_TaskAssembly>$(MSBuildThisFileDirectory)../tools/$(_IACTG_TargetFramework)/IgnoresAccessChecksToGenerator.Tasks.dll
7 | <_IACTG_IntermediatePath>$(IntermediateOutputPath)/IgnoresAccessChecksToGenerator
8 | <_IACTG_CodeFilePath>$(_IACTG_IntermediatePath)/IgnoresAccessChecksTo.cs
9 | <_IACTG_ManifestFilePath>$(_IACTG_IntermediatePath)/IgnoresAccessChecksToGenerator.manifest
10 |
11 |
12 |
13 |
14 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | <_IACTG_ReferencePathJoin Include="@(ReferencePath)" IgnoresAccessChecksTo="%(IgnoresAccessChecksTo.Identity)" />
31 | <_IACTG_InputReferencePath Include="@(_IACTG_ReferencePathJoin)" Condition=" '%(Filename)' == '%(IgnoresAccessChecksTo)' " />
32 | <_IACTG_ReferencePathJoin Remove="@(_IACTG_ReferencePathJoin)" />
33 | <_IACTG_OutputReferencePath Include="@(_IACTG_InputReferencePath->'$(_IACTG_IntermediatePath)/%(Filename)%(Extension)')" OriginalItemSpec="%(Identity)" />
34 |
35 |
36 | <_IACTG_Manifest Include="@(IgnoresAccessChecksToExcludeTypeName)" />
37 |
38 |
39 |
40 |
41 |
47 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | <_IACTG_Directory Include="$(_IACTG_IntermediatePath)" />
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/src/IgnoresAccessChecksToGenerator.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.33103.201
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IgnoresAccessChecksToGenerator.Tasks", "IgnoresAccessChecksToGenerator.Tasks\IgnoresAccessChecksToGenerator.Tasks.csproj", "{FFFAEEE5-E216-442C-9162-168AD30F57F5}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{D43D3D13-84B1-4D21-8E36-52BED4056097}"
9 | ProjectSection(SolutionItems) = preProject
10 | Build\IgnoresAccessChecksToGenerator.props = Build\IgnoresAccessChecksToGenerator.props
11 | Build\IgnoresAccessChecksToGenerator.targets = Build\IgnoresAccessChecksToGenerator.targets
12 | EndProjectSection
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {FFFAEEE5-E216-442C-9162-168AD30F57F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {FFFAEEE5-E216-442C-9162-168AD30F57F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {FFFAEEE5-E216-442C-9162-168AD30F57F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {FFFAEEE5-E216-442C-9162-168AD30F57F5}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {93618651-EC7C-40FD-9683-C87FEC4A4947}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/test/IgnoresAccessChecksToGenerator.Test/IgnoresAccessChecksToGenerator.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | Exe
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/test/IgnoresAccessChecksToGenerator.Test/IgnoresAccessChecksToGenerator.Test.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26430.16
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IgnoresAccessChecksToGenerator.Test", "IgnoresAccessChecksToGenerator.Test.csproj", "{9BA0FB27-1DAF-43CD-A0EE-F952EE198D5F}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {9BA0FB27-1DAF-43CD-A0EE-F952EE198D5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {9BA0FB27-1DAF-43CD-A0EE-F952EE198D5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {9BA0FB27-1DAF-43CD-A0EE-F952EE198D5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {9BA0FB27-1DAF-43CD-A0EE-F952EE198D5F}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/test/IgnoresAccessChecksToGenerator.Test/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.CodeAnalysis.CSharp;
3 |
4 | namespace IgnoresAccessChecksToGenerator.Test
5 | {
6 | public class Program
7 | {
8 | static void Main(string[] args)
9 | {
10 | var c = CSharpCompilation.Create("X");
11 | Console.WriteLine(c.HasSubmissionResult());
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/test/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------